@axa-fr/canopee-react 2.0.0-alpha.73 → 2.0.0-alpha.75
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/distributeur/Accordion/Accordion.d.ts +1 -3
- package/dist/distributeur/Accordion/Accordion.js +2 -5
- package/dist/distributeur/Accordion/CollapseCard.d.ts +1 -3
- package/dist/distributeur/Accordion/CollapseCard.js +2 -4
- package/dist/distributeur/Accordion/Header.d.ts +1 -3
- package/dist/distributeur/Accordion/Header.js +1 -2
- package/dist/distributeur/Action/Action.d.ts +1 -3
- package/dist/distributeur/Action/Action.js +2 -3
- package/dist/distributeur/Form/Checkbox/CheckboxInput.js +2 -2
- package/dist/distributeur/Form/Checkbox/CheckboxItem.d.ts +1 -3
- package/dist/distributeur/Form/Checkbox/CheckboxItem.js +2 -2
- package/dist/distributeur/Form/Choice/Choice.d.ts +0 -2
- package/dist/distributeur/Form/Choice/ChoiceInput.js +1 -1
- package/dist/distributeur/Form/Date/Date.d.ts +2 -3
- package/dist/distributeur/Form/Date/Date.js +3 -3
- package/dist/distributeur/Form/Date/DateInput.js +1 -1
- package/dist/distributeur/Form/File/File.d.ts +1 -3
- package/dist/distributeur/Form/File/File.js +1 -2
- package/dist/distributeur/Form/File/FileInput.d.ts +3 -1
- package/dist/distributeur/Form/File/FileInput.js +2 -2
- package/dist/distributeur/Form/File/FileLine.d.ts +1 -2
- package/dist/distributeur/Form/File/FileLine.js +6 -3
- package/dist/distributeur/Form/File/FileTable.d.ts +1 -2
- package/dist/distributeur/Form/File/FileTable.js +6 -3
- package/dist/distributeur/Form/MultiSelect/MultiSelectInput.js +1 -1
- package/dist/distributeur/Form/NestedQuestion/NestedQuestion.js +6 -3
- package/dist/distributeur/Form/Number/Number.d.ts +2 -5
- package/dist/distributeur/Form/Number/Number.js +2 -3
- package/dist/distributeur/Form/Number/NumberInput.js +1 -1
- package/dist/distributeur/Form/Radio/Radio.d.ts +1 -1
- package/dist/distributeur/Form/Radio/RadioInput.js +1 -1
- package/dist/distributeur/Form/Radio/RadioItem.d.ts +1 -3
- package/dist/distributeur/Form/Radio/RadioItem.js +2 -2
- package/dist/distributeur/Form/Select/Select.d.ts +3 -19
- package/dist/distributeur/Form/Select/Select.js +3 -4
- package/dist/distributeur/Form/Select/SelectBase.d.ts +3 -24
- package/dist/distributeur/Form/Select/SelectBase.js +2 -7
- package/dist/distributeur/Form/Select/SelectDefault.d.ts +3 -3
- package/dist/distributeur/Form/Select/SelectInput.js +1 -1
- package/dist/distributeur/Form/Select/index.d.ts +0 -1
- package/dist/distributeur/Form/Select/index.js +0 -1
- package/dist/distributeur/Form/Text/Text.d.ts +2 -3
- package/dist/distributeur/Form/Text/Text.js +3 -3
- package/dist/distributeur/Form/Text/TextInput.js +1 -1
- package/dist/distributeur/Form/Textarea/Textarea.d.ts +2 -3
- package/dist/distributeur/Form/Textarea/Textarea.js +3 -3
- package/dist/distributeur/Form/Textarea/TextareaInput.js +1 -1
- package/dist/distributeur/Form/core/Field.d.ts +4 -23
- package/dist/distributeur/Form/core/Field.js +25 -16
- package/dist/distributeur/Form/core/FieldError.js +5 -2
- package/dist/distributeur/Form/core/getOptionClassName.d.ts +1 -1
- package/dist/distributeur/Form/core/getOptionClassName.js +2 -6
- package/dist/distributeur/Form/core/index.d.ts +0 -8
- package/dist/distributeur/Form/core/index.js +0 -4
- package/dist/distributeur/HelpButton/index.d.ts +1 -1
- package/dist/distributeur/HelpButton/index.js +4 -6
- package/dist/distributeur/Layout/Header/Header.d.ts +1 -3
- package/dist/distributeur/Layout/Header/Header.js +1 -2
- package/dist/distributeur/Layout/Header/HeaderTitle/HeaderTitle.d.ts +1 -2
- package/dist/distributeur/Layout/Header/HeaderTitle/HeaderTitle.js +7 -4
- package/dist/distributeur/Layout/Header/Infos/Infos.d.ts +1 -3
- package/dist/distributeur/Layout/Header/Infos/Infos.js +1 -2
- package/dist/distributeur/Layout/Header/Name/Name.d.ts +1 -3
- package/dist/distributeur/Layout/Header/Name/Name.js +1 -2
- package/dist/distributeur/Layout/Header/NavBar/NavBar.js +1 -6
- package/dist/distributeur/Layout/Header/NavBar/NavBarBase.d.ts +1 -3
- package/dist/distributeur/Layout/Header/NavBar/NavBarBase.js +7 -3
- package/dist/distributeur/Layout/Header/NavBar/NavBarItem/NavBarItem.d.ts +2 -2
- package/dist/distributeur/Layout/Header/NavBar/NavBarItem/NavBarItem.js +10 -3
- package/dist/distributeur/Layout/Header/NavBar/NavBarItem/NavBarItemBase.d.ts +1 -2
- package/dist/distributeur/Layout/Header/NavBar/NavBarItem/NavBarItemBase.js +6 -3
- package/dist/distributeur/Layout/Header/User/User.d.ts +1 -11
- package/dist/distributeur/Layout/Header/User/User.js +1 -2
- package/dist/distributeur/Messages/Message.d.ts +2 -6
- package/dist/distributeur/Messages/Message.js +3 -14
- package/dist/distributeur/ModalAgent/BooleanModal.d.ts +1 -6
- package/dist/distributeur/ModalAgent/BooleanModal.js +7 -4
- package/dist/distributeur/ModalAgent/Modal.d.ts +2 -7
- package/dist/distributeur/ModalAgent/Modal.js +7 -16
- package/dist/distributeur/ModalAgent/components/Body.d.ts +2 -5
- package/dist/distributeur/ModalAgent/components/Body.js +1 -2
- package/dist/distributeur/ModalAgent/components/Footer.d.ts +2 -5
- package/dist/distributeur/ModalAgent/components/Footer.js +1 -2
- package/dist/distributeur/ModalAgent/components/Header.d.ts +1 -11
- package/dist/distributeur/ModalAgent/components/Header.js +2 -3
- package/dist/distributeur/ModalAgent/components/HeaderBase.d.ts +2 -5
- package/dist/distributeur/ModalAgent/components/HeaderBase.js +1 -2
- package/dist/distributeur/Popover/AnimatedPopover.d.ts +1 -3
- package/dist/distributeur/Popover/AnimatedPopover.js +1 -2
- package/dist/distributeur/Popover/Popover.d.ts +1 -3
- package/dist/distributeur/Popover/Popover.js +2 -2
- package/dist/distributeur/Popover/Popover.types.d.ts +0 -2
- package/dist/distributeur/Popover/PopoverBase.d.ts +1 -3
- package/dist/distributeur/Popover/PopoverBase.js +2 -2
- package/dist/distributeur/Popover/PopoverClick.d.ts +1 -1
- package/dist/distributeur/Popover/PopoverClick.js +2 -2
- package/dist/distributeur/Popover/PopoverOver.d.ts +1 -1
- package/dist/distributeur/Popover/PopoverOver.js +2 -2
- package/dist/distributeur/Restitution/ArticleRestitution.d.ts +2 -5
- package/dist/distributeur/Restitution/ArticleRestitution.js +1 -2
- package/dist/distributeur/Restitution/HeaderRestitution.d.ts +1 -3
- package/dist/distributeur/Restitution/HeaderRestitution.js +1 -2
- package/dist/distributeur/Restitution/Restitution.d.ts +1 -3
- package/dist/distributeur/Restitution/Restitution.js +2 -2
- package/dist/distributeur/Restitution/SectionRestitution.d.ts +1 -3
- package/dist/distributeur/Restitution/SectionRestitution.js +1 -2
- package/dist/distributeur/Restitution/SectionRestitutionColumn.d.ts +1 -3
- package/dist/distributeur/Restitution/SectionRestitutionColumn.js +1 -2
- package/dist/distributeur/Restitution/SectionRestitutionRow.d.ts +1 -3
- package/dist/distributeur/Restitution/SectionRestitutionRow.js +5 -9
- package/dist/distributeur/Restitution/SectionRestitutionTitle.d.ts +1 -3
- package/dist/distributeur/Restitution/SectionRestitutionTitle.js +1 -2
- package/dist/distributeur/Steps/Step.d.ts +1 -1
- package/dist/distributeur/Steps/Step.js +4 -4
- package/dist/distributeur/Steps/StepBase.d.ts +1 -3
- package/dist/distributeur/Steps/StepBase.js +1 -2
- package/dist/distributeur/Steps/Steps.d.ts +1 -3
- package/dist/distributeur/Steps/Steps.js +1 -2
- package/dist/distributeur/Summary/index.d.ts +1 -1
- package/dist/distributeur/Summary/index.js +1 -2
- package/dist/distributeur/Table/Pagination/Items.d.ts +1 -2
- package/dist/distributeur/Table/Pagination/Items.js +8 -8
- package/dist/distributeur/Table/Pagination/Pager.d.ts +1 -2
- package/dist/distributeur/Table/Pagination/Pager.js +6 -3
- package/dist/distributeur/Table/Pagination/Paging.d.ts +1 -1
- package/dist/distributeur/Table/Pagination/Paging.js +6 -3
- package/dist/distributeur/Table/TBody.d.ts +1 -5
- package/dist/distributeur/Table/TBody.js +1 -2
- package/dist/distributeur/Table/THead.d.ts +2 -5
- package/dist/distributeur/Table/THead.js +2 -2
- package/dist/distributeur/Table/Table.d.ts +6 -33
- package/dist/distributeur/Table/Table.js +1 -10
- package/dist/distributeur/Table/Td.d.ts +1 -5
- package/dist/distributeur/Table/Td.js +1 -2
- package/dist/distributeur/Table/Th.d.ts +2 -4
- package/dist/distributeur/Table/Th.js +2 -2
- package/dist/distributeur/Table/Tr.d.ts +2 -5
- package/dist/distributeur/Table/Tr.js +2 -2
- package/dist/distributeur/Table/index.d.ts +1 -1
- package/dist/distributeur/Tabs/components/Tab.d.ts +0 -4
- package/dist/distributeur/Tabs/components/TabsStateless.d.ts +1 -5
- package/dist/distributeur/Tabs/components/TabsStateless.js +2 -2
- package/dist/distributeur/Tag/Tag.d.ts +1 -6
- package/dist/distributeur/Tag/Tag.js +2 -2
- package/dist/distributeur/Title/Title.d.ts +1 -3
- package/dist/distributeur/Title/Title.js +2 -2
- package/dist/distributeur/utilities.d.ts +1 -1
- package/dist/distributeur/utilities.js +1 -1
- package/dist/distributeur.d.ts +5 -24
- package/dist/distributeur.js +5 -17
- package/package.json +2 -2
- package/dist/distributeur/Form/Pass/Pass.d.ts +0 -15
- package/dist/distributeur/Form/Pass/Pass.js +0 -13
- package/dist/distributeur/Form/Pass/PassInput.d.ts +0 -13
- package/dist/distributeur/Form/Pass/PassInput.js +0 -34
- package/dist/distributeur/Form/Pass/index.d.ts +0 -2
- package/dist/distributeur/Form/Pass/index.js +0 -2
- package/dist/distributeur/Form/Select/SelectDefaultWithOptions.d.ts +0 -26
- package/dist/distributeur/Form/Select/SelectDefaultWithOptions.js +0 -32
- package/dist/distributeur/Form/Slider/Slider.d.ts +0 -28
- package/dist/distributeur/Form/Slider/Slider.js +0 -40
- package/dist/distributeur/Form/Slider/SliderInput.d.ts +0 -9
- package/dist/distributeur/Form/Slider/SliderInput.js +0 -11
- package/dist/distributeur/Form/Slider/index.d.ts +0 -3
- package/dist/distributeur/Form/Slider/index.js +0 -3
- package/dist/distributeur/Form/core/Deprecated/Field.d.ts +0 -21
- package/dist/distributeur/Form/core/Deprecated/Field.js +0 -20
- package/dist/distributeur/Form/core/Deprecated/FieldForm.d.ts +0 -103
- package/dist/distributeur/Form/core/Deprecated/FieldForm.js +0 -162
- package/dist/distributeur/Form/core/Deprecated/FieldInput.d.ts +0 -16
- package/dist/distributeur/Form/core/Deprecated/FieldInput.js +0 -14
- package/dist/distributeur/Form/core/useInputClassModifier.d.ts +0 -4
- package/dist/distributeur/Form/core/useInputClassModifier.js +0 -13
- package/dist/distributeur/Layout/Header/HeaderTitle/HeaderTitle.helpers.d.ts +0 -1
- package/dist/distributeur/Layout/Header/HeaderTitle/HeaderTitle.helpers.js +0 -6
- package/dist/distributeur/utilities/helpers/getComponentClassName.d.ts +0 -20
- package/dist/distributeur/utilities/helpers/getComponentClassName.js +0 -54
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import "@axa-fr/canopee-css/distributeur/Form/Text/Text.css";
|
|
2
2
|
import { type ComponentPropsWithRef } from "react";
|
|
3
3
|
type Props = ComponentPropsWithRef<"input"> & {
|
|
4
|
-
|
|
5
|
-
classModifier?: string;
|
|
4
|
+
hasInfobulle?: boolean;
|
|
6
5
|
};
|
|
7
6
|
declare const Text: {
|
|
8
|
-
({ className,
|
|
7
|
+
({ className, required, hasInfobulle, ...otherProps }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
8
|
displayName: string;
|
|
10
9
|
};
|
|
11
10
|
export { Text };
|
|
@@ -2,13 +2,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import "@axa-fr/canopee-css/distributeur/Form/Text/Text.css";
|
|
3
3
|
import {} from "react";
|
|
4
4
|
import { getClassName } from "../../utilities/helpers/getClassName";
|
|
5
|
-
const Text = ({ className,
|
|
5
|
+
const Text = ({ className, required, hasInfobulle, ...otherProps }) => {
|
|
6
6
|
const componentClassName = getClassName({
|
|
7
7
|
baseClassName: "af-form__input-text",
|
|
8
|
-
modifiers:
|
|
8
|
+
modifiers: [hasInfobulle && "hasinfobulle"],
|
|
9
9
|
className,
|
|
10
10
|
});
|
|
11
|
-
return (_jsx("input", { className: componentClassName, type: "text", required: required
|
|
11
|
+
return (_jsx("input", { className: componentClassName, type: "text", required: required, ...otherProps }));
|
|
12
12
|
};
|
|
13
13
|
Text.displayName = "Text";
|
|
14
14
|
export { Text };
|
|
@@ -2,6 +2,6 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import {} from "react";
|
|
3
3
|
import { Field } from "../core";
|
|
4
4
|
import { Text } from "./Text";
|
|
5
|
-
const TextInput = ({ children, ...props }) => (_jsx(Field, { ...props, renderInput: ({ id,
|
|
5
|
+
const TextInput = ({ children, ...props }) => (_jsx(Field, { ...props, renderInput: ({ id, inputClassName, ariaInvalid, errorId, ...textProps }) => (_jsxs(_Fragment, { children: [_jsx(Text, { id: id, className: inputClassName, "aria-describedby": errorId, "aria-invalid": ariaInvalid, ...textProps }), children] })) }));
|
|
6
6
|
TextInput.displayName = "TextInput";
|
|
7
7
|
export { TextInput };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import "@axa-fr/canopee-css/distributeur/Form/Textarea/Textarea.css";
|
|
2
2
|
import { type ComponentPropsWithRef } from "react";
|
|
3
3
|
type Props = ComponentPropsWithRef<"textarea"> & {
|
|
4
|
-
|
|
5
|
-
classModifier?: string;
|
|
4
|
+
hasInfobulle?: boolean;
|
|
6
5
|
};
|
|
7
6
|
declare const Textarea: {
|
|
8
|
-
({ id, className,
|
|
7
|
+
({ id, className, required, hasInfobulle, ...otherProps }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
8
|
displayName: string;
|
|
10
9
|
};
|
|
11
10
|
export { Textarea };
|
|
@@ -2,15 +2,15 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import "@axa-fr/canopee-css/distributeur/Form/Textarea/Textarea.css";
|
|
3
3
|
import { useId } from "react";
|
|
4
4
|
import { getClassName } from "../../utilities/helpers/getClassName";
|
|
5
|
-
const Textarea = ({ id, className,
|
|
5
|
+
const Textarea = ({ id, className, required, hasInfobulle, ...otherProps }) => {
|
|
6
6
|
const inputUseId = useId();
|
|
7
7
|
const inputId = id ?? inputUseId;
|
|
8
8
|
const componentClassName = getClassName({
|
|
9
9
|
baseClassName: "af-form__input-textarea",
|
|
10
|
-
modifiers:
|
|
10
|
+
modifiers: [hasInfobulle && "hasinfobulle"],
|
|
11
11
|
className,
|
|
12
12
|
});
|
|
13
|
-
return (_jsx("textarea", { ...otherProps, id: inputId, className: componentClassName, required:
|
|
13
|
+
return (_jsx("textarea", { ...otherProps, id: inputId, className: componentClassName, required: required }));
|
|
14
14
|
};
|
|
15
15
|
Textarea.displayName = "Textarea";
|
|
16
16
|
export { Textarea };
|
|
@@ -3,6 +3,6 @@ import "@axa-fr/canopee-css/distributeur/Form/Textarea/Textarea.css";
|
|
|
3
3
|
import {} from "react";
|
|
4
4
|
import { Field } from "../core";
|
|
5
5
|
import { Textarea } from "./Textarea";
|
|
6
|
-
const TextareaInput = ({ label, children, ...props }) => (_jsx(Field, { label: label, labelPosition: "top",
|
|
6
|
+
const TextareaInput = ({ label, children, ...props }) => (_jsx(Field, { label: label, labelPosition: "top", fieldClassNameSuffix: "textarea", ...props, renderInput: ({ id, inputClassName, ariaInvalid, errorId, ...inputProps }) => (_jsxs(_Fragment, { children: [_jsx(Textarea, { id: id, className: inputClassName, "aria-describedby": errorId, "aria-invalid": ariaInvalid, ...inputProps }), children] })) }));
|
|
7
7
|
TextareaInput.displayName = "TextareaInput";
|
|
8
8
|
export { TextareaInput };
|
|
@@ -10,16 +10,8 @@ type InputProps = {
|
|
|
10
10
|
*/
|
|
11
11
|
id?: string;
|
|
12
12
|
className?: string;
|
|
13
|
-
classModifier?: string;
|
|
14
13
|
classNameContainerLabel?: string;
|
|
15
14
|
classNameContainerInput?: string;
|
|
16
|
-
/**
|
|
17
|
-
* Setting this to false will disable the rendering of the component
|
|
18
|
-
* @default true
|
|
19
|
-
* @deprecated You should handle the visibility of the component in your code
|
|
20
|
-
* instead of using this prop. This prop will be removed in a future version.
|
|
21
|
-
*/
|
|
22
|
-
isVisible?: boolean;
|
|
23
15
|
roleContainer?: string;
|
|
24
16
|
ariaLabelContainer?: string;
|
|
25
17
|
isLabelContainerLinkedToInput?: boolean;
|
|
@@ -28,6 +20,7 @@ type InputProps = {
|
|
|
28
20
|
messageType?: MessageTypes;
|
|
29
21
|
required?: boolean;
|
|
30
22
|
disabled?: boolean;
|
|
23
|
+
hasInfobulle?: boolean;
|
|
31
24
|
helpMessage?: ReactNode;
|
|
32
25
|
/**
|
|
33
26
|
* Sets the position of the label relative to the input.
|
|
@@ -37,22 +30,10 @@ type InputProps = {
|
|
|
37
30
|
*
|
|
38
31
|
*/
|
|
39
32
|
labelPosition?: "top" | "center";
|
|
40
|
-
|
|
41
|
-
* suffix appended to the className of the div wrapping the input
|
|
42
|
-
* @deprecated We should rationalize the CSS for the components to avoid having to use different sufixes
|
|
43
|
-
* but it would be a breaking change to do so, so we keep it for now
|
|
44
|
-
* @example "textarea" will result in
|
|
45
|
-
* ```html
|
|
46
|
-
* <div class="af-form__textarea">
|
|
47
|
-
* // ... input
|
|
48
|
-
* </div>
|
|
49
|
-
* ```
|
|
50
|
-
* @default "text"
|
|
51
|
-
*/
|
|
52
|
-
classNameSuffix?: string;
|
|
33
|
+
fieldClassNameSuffix?: string;
|
|
53
34
|
renderInput: (props: {
|
|
54
35
|
id: string;
|
|
55
|
-
|
|
36
|
+
inputClassName: string;
|
|
56
37
|
errorId?: string;
|
|
57
38
|
ariaInvalid?: boolean;
|
|
58
39
|
} & Record<string, unknown>) => ReactNode;
|
|
@@ -76,5 +57,5 @@ export type ConsumerFieldProps = Omit<InputProps, "renderInput" | "classNameSuff
|
|
|
76
57
|
*/
|
|
77
58
|
children?: ReactNode;
|
|
78
59
|
};
|
|
79
|
-
export declare const Field: ({ classNameContainerInput, classNameContainerLabel, className, label, forceDisplayMessage, message, messageType, required,
|
|
60
|
+
export declare const Field: ({ classNameContainerInput, classNameContainerLabel, className, label, forceDisplayMessage, message, messageType, required, disabled, hasInfobulle, helpMessage, id, roleContainer, ariaLabelContainer, isLabelContainerLinkedToInput, labelPosition, fieldClassNameSuffix, renderInput, appendChildren, ...otherProps }: InputProps) => import("react/jsx-runtime").JSX.Element;
|
|
80
61
|
export {};
|
|
@@ -1,37 +1,46 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
import { useId } from "react";
|
|
4
|
-
import { FieldError, FormClassManager, HelpMessage, MessageTypes
|
|
5
|
-
import {
|
|
4
|
+
import { FieldError, FormClassManager, HelpMessage, MessageTypes } from ".";
|
|
5
|
+
import { getClassName } from "../../utilities";
|
|
6
6
|
import { useAriaInvalid } from "./useAriaInvalid";
|
|
7
7
|
function isIdDefined(id) {
|
|
8
8
|
return typeof id === "string" && id.length > 0;
|
|
9
9
|
}
|
|
10
|
-
export const Field = ({ classNameContainerInput = "col-md-10", classNameContainerLabel = "col-md-2", className, label, forceDisplayMessage, message, messageType, required,
|
|
10
|
+
export const Field = ({ classNameContainerInput = "col-md-10", classNameContainerLabel = "col-md-2", className, label, forceDisplayMessage, message, messageType, required, disabled = false, hasInfobulle, helpMessage, id, roleContainer, ariaLabelContainer, isLabelContainerLinkedToInput = true, labelPosition = "center", fieldClassNameSuffix = "text", renderInput, appendChildren, ...otherProps }) => {
|
|
11
11
|
const inputUseId = useId();
|
|
12
12
|
const inputId = isIdDefined(id) ? id : inputUseId;
|
|
13
|
-
const actualRequired = required || classModifier.includes("required");
|
|
14
13
|
const isInvalid = useAriaInvalid(message, forceDisplayMessage, messageType);
|
|
15
14
|
const errorId = forceDisplayMessage || helpMessage ? `${inputId}-description` : undefined;
|
|
16
|
-
const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier, disabled, false, actualRequired);
|
|
17
15
|
const labelId = useId();
|
|
18
|
-
if (!isVisible) {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
16
|
const isGroup = roleContainer === "radiogroup" || roleContainer === "group";
|
|
22
17
|
const LabelElement = isGroup ? "div" : "label";
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
const fieldModifiers = [
|
|
19
|
+
disabled && "disabled",
|
|
20
|
+
required && "required",
|
|
21
|
+
forceDisplayMessage && FormClassManager.getModifier(messageType),
|
|
22
|
+
];
|
|
23
|
+
const inputClassName = [
|
|
24
|
+
...fieldModifiers,
|
|
25
|
+
hasInfobulle && `af-form__input-${fieldClassNameSuffix}--hasinfobulle`,
|
|
26
|
+
]
|
|
27
|
+
.filter(Boolean)
|
|
28
|
+
.join(" ");
|
|
29
|
+
const fieldContainerClassName = getClassName({
|
|
30
|
+
baseClassName: `af-form__${fieldClassNameSuffix}`,
|
|
31
|
+
modifiers: fieldModifiers,
|
|
32
|
+
});
|
|
33
|
+
const groupClassName = getClassName({
|
|
34
|
+
baseClassName: "af-form__group",
|
|
35
|
+
className,
|
|
36
|
+
});
|
|
28
37
|
return (_jsxs("div", { className: classNames("row", groupClassName, {
|
|
29
|
-
"af-form__group--required":
|
|
38
|
+
"af-form__group--required": required,
|
|
30
39
|
"af-form__group--label-top": labelPosition === "top",
|
|
31
40
|
}), role: roleContainer, "aria-invalid": isGroup ? isInvalid : undefined, "aria-required": isGroup ? required : undefined, "aria-label": ariaLabelContainer, "aria-labelledby": isGroup ? labelId : undefined, "aria-errormessage": isGroup && isInvalid ? errorId : undefined, children: [_jsx("div", { className: classNameContainerLabel, children: _jsx(LabelElement, { className: classNames("af-form__group-label", {
|
|
32
|
-
"af-form__group-label--required":
|
|
41
|
+
"af-form__group-label--required": required,
|
|
33
42
|
}), htmlFor: isLabelContainerLinkedToInput ? inputId : undefined, id: labelId, children: label }) }), _jsxs("div", { className: classNameContainerInput, children: [_jsx("div", { className: fieldContainerClassName, children: renderInput({
|
|
34
|
-
|
|
43
|
+
inputClassName,
|
|
35
44
|
id: inputId,
|
|
36
45
|
errorId,
|
|
37
46
|
disabled,
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { getClassName } from "../../utilities";
|
|
3
3
|
import { MessageTypes } from "./MessageTypes";
|
|
4
4
|
const DEFAULT_CLASS_NAME = "af-form__message";
|
|
5
5
|
export const FieldError = ({ message = null, messageType = MessageTypes.error, errorId = undefined, }) => {
|
|
6
|
-
const className =
|
|
6
|
+
const className = getClassName({
|
|
7
|
+
baseClassName: DEFAULT_CLASS_NAME,
|
|
8
|
+
modifiers: [messageType],
|
|
9
|
+
});
|
|
7
10
|
return (message && (_jsxs("small", { className: className, children: [_jsx("span", { className: "glyphicon glyphicon-exclamation-sign" }), _jsx("span", { id: errorId, role: "alert", className: `af-form__${messageType}-text`, children: message })] })));
|
|
8
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function getOptionClassName(className: string,
|
|
1
|
+
export declare function getOptionClassName(className: string, defaultClassName: string, disabled: boolean, variant?: string): string;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { getClassName } from "../../utilities/helpers/getClassName";
|
|
2
|
-
export function getOptionClassName(className,
|
|
2
|
+
export function getOptionClassName(className, defaultClassName, disabled, variant) {
|
|
3
3
|
return getClassName({
|
|
4
4
|
baseClassName: className || defaultClassName,
|
|
5
|
-
modifiers: [
|
|
6
|
-
variant,
|
|
7
|
-
...(classModifier?.split(" ") ?? []),
|
|
8
|
-
disabled && "disabled",
|
|
9
|
-
],
|
|
5
|
+
modifiers: [variant, disabled && "disabled"],
|
|
10
6
|
className,
|
|
11
7
|
});
|
|
12
8
|
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
export { LegacyField } from "./Deprecated/Field";
|
|
3
|
-
export { FieldForm } from "./Deprecated/FieldForm";
|
|
4
|
-
export { FieldInput } from "./Deprecated/FieldInput";
|
|
5
2
|
export { Field } from "./Field";
|
|
6
3
|
export type { ConsumerFieldProps } from "./Field";
|
|
7
4
|
export { FieldError } from "./FieldError";
|
|
@@ -11,16 +8,11 @@ export { InputList } from "./InputList";
|
|
|
11
8
|
export { MessageTypes } from "./MessageTypes";
|
|
12
9
|
export { getFirstId } from "./getFirstId";
|
|
13
10
|
export { getOptionClassName } from "./getOptionClassName";
|
|
14
|
-
export { useInputClassModifier } from "./useInputClassModifier";
|
|
15
11
|
export { useOptionsWithId } from "./useOptionsWithId";
|
|
16
12
|
export type Option = {
|
|
17
13
|
id?: string;
|
|
18
14
|
icon?: ReactNode;
|
|
19
15
|
label: ReactNode;
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated Ne semble pas utilisé
|
|
22
|
-
*/
|
|
23
|
-
description?: ReactNode;
|
|
24
16
|
value: string;
|
|
25
17
|
} & React.InputHTMLAttributes<HTMLInputElement>;
|
|
26
18
|
type BaseFormEvent = {
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export { LegacyField } from "./Deprecated/Field";
|
|
2
|
-
export { FieldForm } from "./Deprecated/FieldForm";
|
|
3
|
-
export { FieldInput } from "./Deprecated/FieldInput";
|
|
4
1
|
export { Field } from "./Field";
|
|
5
2
|
export { FieldError } from "./FieldError";
|
|
6
3
|
export { FormClassManager } from "./FormClassManager";
|
|
@@ -9,5 +6,4 @@ export { InputList } from "./InputList";
|
|
|
9
6
|
export { MessageTypes } from "./MessageTypes";
|
|
10
7
|
export { getFirstId } from "./getFirstId";
|
|
11
8
|
export { getOptionClassName } from "./getOptionClassName";
|
|
12
|
-
export { useInputClassModifier } from "./useInputClassModifier";
|
|
13
9
|
export { useOptionsWithId } from "./useOptionsWithId";
|
|
@@ -5,5 +5,5 @@ type HelpProps = Omit<ComponentPropsWithoutRef<typeof Popover>, "popoverElement"
|
|
|
5
5
|
helpButtonContent?: ReactNode;
|
|
6
6
|
variant?: "default" | "inverse";
|
|
7
7
|
};
|
|
8
|
-
export declare const HelpButton: ({ className,
|
|
8
|
+
export declare const HelpButton: ({ className, children, mode, placement, variant, helpButtonContent, }: HelpProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -5,13 +5,11 @@ import info from "@material-symbols/svg-400/rounded/info_i-fill.svg";
|
|
|
5
5
|
import { Popover } from "../Popover";
|
|
6
6
|
import { getClassName } from "../utilities/helpers/getClassName";
|
|
7
7
|
import { Svg } from "../Svg";
|
|
8
|
-
export const HelpButton = ({ className,
|
|
8
|
+
export const HelpButton = ({ className, children, mode = "click", placement = "right", variant = "default", helpButtonContent = _jsx(Svg, { src: info, alt: "Help" }), }) => {
|
|
9
9
|
const buttonClassName = classNames("btn", getClassName({
|
|
10
10
|
baseClassName: "af-btn--circle",
|
|
11
|
-
modifiers: [
|
|
12
|
-
|
|
13
|
-
...(variant === "inverse" ? ["inverse"] : []),
|
|
14
|
-
],
|
|
11
|
+
modifiers: [variant === "inverse" && "inverse"],
|
|
12
|
+
className,
|
|
15
13
|
}));
|
|
16
|
-
return (_jsx(Popover, { className: classNames("af-help-button", className),
|
|
14
|
+
return (_jsx(Popover, { className: classNames("af-help-button", className), placement: placement, mode: mode, popoverElement: children, children: _jsx("div", { className: buttonClassName, children: helpButtonContent }) }));
|
|
17
15
|
};
|
|
@@ -2,9 +2,7 @@ import "@axa-fr/canopee-css/distributeur/Layout/Header/Header.css";
|
|
|
2
2
|
import { type ReactNode } from "react";
|
|
3
3
|
type Props = {
|
|
4
4
|
children: ReactNode;
|
|
5
|
-
/** @deprecated Use `className` instead. */
|
|
6
|
-
classModifier?: string;
|
|
7
5
|
className?: string;
|
|
8
6
|
};
|
|
9
|
-
declare const Header: ({
|
|
7
|
+
declare const Header: ({ className, children }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
10
8
|
export { Header };
|
|
@@ -4,10 +4,9 @@ import classNames from "classnames";
|
|
|
4
4
|
import {} from "react";
|
|
5
5
|
import { getClassName } from "../../utilities/helpers/getClassName";
|
|
6
6
|
const defaultClassName = "af-header";
|
|
7
|
-
const Header = ({
|
|
7
|
+
const Header = ({ className, children }) => {
|
|
8
8
|
const componentClassName = getClassName({
|
|
9
9
|
baseClassName: defaultClassName,
|
|
10
|
-
modifiers: classModifier?.split(" "),
|
|
11
10
|
className,
|
|
12
11
|
});
|
|
13
12
|
return (_jsx("div", { className: classNames("af-container", componentClassName), children: _jsx("header", { className: `${defaultClassName}__content`, role: "banner", children: children }) }));
|
|
@@ -3,7 +3,6 @@ import type { ReactNode } from "react";
|
|
|
3
3
|
import { type AnchorNavBarItem } from "../AnchorNavBar/AnchorNavBar";
|
|
4
4
|
type Props = {
|
|
5
5
|
children?: ReactNode;
|
|
6
|
-
classModifier?: string;
|
|
7
6
|
className?: string;
|
|
8
7
|
isSticky?: boolean;
|
|
9
8
|
contentLeft?: ReactNode;
|
|
@@ -13,5 +12,5 @@ type Props = {
|
|
|
13
12
|
toggleMenu?: () => void;
|
|
14
13
|
anchorNavBarItems?: AnchorNavBarItem[];
|
|
15
14
|
};
|
|
16
|
-
declare const HeaderTitle: ({ children,
|
|
15
|
+
declare const HeaderTitle: ({ children, className, isSticky, contentLeft, contentRight, subtitle, title, toggleMenu, anchorNavBarItems, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
17
16
|
export { HeaderTitle };
|
|
@@ -2,13 +2,16 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import "@axa-fr/canopee-css/distributeur/Layout/Header/HeaderTitle/HeaderTitle.css";
|
|
3
3
|
import classNames from "classnames";
|
|
4
4
|
import { Action } from "../../../Action/Action";
|
|
5
|
-
import {
|
|
5
|
+
import { getClassName } from "../../../utilities";
|
|
6
6
|
import { AnchorNavBar, } from "../AnchorNavBar/AnchorNavBar";
|
|
7
7
|
import { ToggleButton } from "../ToggleButton/ToggleButton";
|
|
8
|
-
import { getClassModifier } from "./HeaderTitle.helpers";
|
|
9
8
|
const defaultClassName = "af-title-bar";
|
|
10
|
-
const HeaderTitle = ({ children,
|
|
11
|
-
const componentClassName =
|
|
9
|
+
const HeaderTitle = ({ children, className, isSticky = true, contentLeft, contentRight, subtitle, title, toggleMenu, anchorNavBarItems, }) => {
|
|
10
|
+
const componentClassName = getClassName({
|
|
11
|
+
baseClassName: defaultClassName,
|
|
12
|
+
modifiers: [isSticky && "sticky"],
|
|
13
|
+
className,
|
|
14
|
+
});
|
|
12
15
|
const isAnchorNavBarPresent = anchorNavBarItems && anchorNavBarItems.length > 0;
|
|
13
16
|
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: classNames("af-container", componentClassName), children: [Boolean(toggleMenu) && (_jsx("div", { className: "burger-container", children: _jsx(ToggleButton, { idControl: "mainmenu", children: _jsx(Action, { className: "btn af-title-bar__mobile-menu af-btn--circle", id: "togglemenu", icon: "menu-hamburger", title: "Toggle menu", onClick: toggleMenu }) }) })), _jsxs("div", { className: `${defaultClassName}__leftSection`, children: [contentLeft, _jsxs("h1", { className: `${defaultClassName}__title`, children: [title, subtitle ? (_jsx("span", { className: `${defaultClassName}__subtitle`, children: subtitle })) : null] }), children] }), contentRight ? (_jsx("div", { className: `${defaultClassName}__rightSection`, children: contentRight })) : null] }), isAnchorNavBarPresent ? (_jsx(AnchorNavBar, { items: anchorNavBarItems })) : null] }));
|
|
14
17
|
};
|
|
@@ -6,10 +6,8 @@ export type TInfo = {
|
|
|
6
6
|
word: ReactNode;
|
|
7
7
|
};
|
|
8
8
|
type InfosProps = {
|
|
9
|
-
/** @deprecated Use `className` instead. */
|
|
10
|
-
classModifier?: string;
|
|
11
9
|
className?: string;
|
|
12
10
|
infos: TInfo[];
|
|
13
11
|
};
|
|
14
|
-
declare const Infos: ({ infos, className
|
|
12
|
+
declare const Infos: ({ infos, className }: InfosProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
13
|
export { Infos };
|
|
@@ -6,10 +6,9 @@ import { getClassName } from "../../../utilities/helpers/getClassName";
|
|
|
6
6
|
import "@axa-fr/canopee-css/distributeur/Layout/Header/Infos/Infos.css";
|
|
7
7
|
import { Svg } from "../../../Svg";
|
|
8
8
|
const defaultClassName = "af-contrat";
|
|
9
|
-
const Infos = ({ infos, className
|
|
9
|
+
const Infos = ({ infos, className }) => {
|
|
10
10
|
const componentClassName = getClassName({
|
|
11
11
|
baseClassName: defaultClassName,
|
|
12
|
-
modifiers: classModifier?.split(" "),
|
|
13
12
|
className,
|
|
14
13
|
});
|
|
15
14
|
return (_jsxs("div", { className: componentClassName, children: [_jsx(Svg, { className: "af-contrat__icon", src: infoIcon, "aria-hidden": "true" }), _jsx("dl", { className: `${defaultClassName}__list`, children: infos.map((info) => {
|
|
@@ -3,8 +3,6 @@ import "@axa-fr/canopee-css/distributeur/Layout/Header/Name/Name.css";
|
|
|
3
3
|
import { type MouseEvent } from "react";
|
|
4
4
|
type Props = {
|
|
5
5
|
alt?: string;
|
|
6
|
-
/** @deprecated Use `className` instead. */
|
|
7
|
-
classModifier?: string;
|
|
8
6
|
className?: string;
|
|
9
7
|
img?: string;
|
|
10
8
|
onClick?: (action: {
|
|
@@ -13,5 +11,5 @@ type Props = {
|
|
|
13
11
|
subtitle?: string;
|
|
14
12
|
title: string;
|
|
15
13
|
};
|
|
16
|
-
declare const Name: ({ alt,
|
|
14
|
+
declare const Name: ({ alt, className, img, onClick, subtitle, title, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
17
15
|
export { Name };
|
|
@@ -4,10 +4,9 @@ import "@axa-fr/canopee-css/distributeur/Layout/Header/Name/Name.css";
|
|
|
4
4
|
import {} from "react";
|
|
5
5
|
import { getClassName } from "../../../utilities/helpers/getClassName";
|
|
6
6
|
const defaultClassName = "af-header__name";
|
|
7
|
-
const Name = ({ alt = "logo",
|
|
7
|
+
const Name = ({ alt = "logo", className, img, onClick, subtitle, title, }) => {
|
|
8
8
|
const componentClassName = getClassName({
|
|
9
9
|
baseClassName: defaultClassName,
|
|
10
|
-
modifiers: classModifier?.split(" "),
|
|
11
10
|
className,
|
|
12
11
|
});
|
|
13
12
|
return (_jsxs("div", { className: componentClassName, children: [_jsx("a", { className: "af-logo", href: "/", onClick: (event) => onClick && onClick({ event }), children: _jsx("img", { className: "af-logo__brand", src: img, alt: alt }) }), _jsxs("p", { className: "af-header__title", children: [title, _jsx("span", { className: "af-header__subtitle", children: subtitle })] })] }));
|
|
@@ -19,12 +19,7 @@ const NavBar = ({ positionInit = 0, children, ...otherProps }) => {
|
|
|
19
19
|
const isCurrent = index === position;
|
|
20
20
|
return React.cloneElement(child, {
|
|
21
21
|
key: `NavBarItem`,
|
|
22
|
-
|
|
23
|
-
child.props.classModifier,
|
|
24
|
-
isCurrent ? "active" : undefined,
|
|
25
|
-
]
|
|
26
|
-
.filter((c) => Boolean(c))
|
|
27
|
-
.join(" "),
|
|
22
|
+
active: isCurrent,
|
|
28
23
|
tabIndex: isCurrent ? 0 : -1,
|
|
29
24
|
index,
|
|
30
25
|
hasFocus: isMenuFocused && isCurrent,
|
|
@@ -6,8 +6,6 @@ type Props = {
|
|
|
6
6
|
isMenuFocused?: boolean;
|
|
7
7
|
onClick: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
8
8
|
className?: string;
|
|
9
|
-
/** @deprecated Use `className` instead. */
|
|
10
|
-
classModifier?: string;
|
|
11
9
|
handleKeys: (key: string) => void;
|
|
12
10
|
onFocus: (action: {
|
|
13
11
|
e: FocusEvent<HTMLUListElement>;
|
|
@@ -17,5 +15,5 @@ type Props = {
|
|
|
17
15
|
}) => void;
|
|
18
16
|
children?: ReactNode;
|
|
19
17
|
};
|
|
20
|
-
declare const NavBarBase: ({
|
|
18
|
+
declare const NavBarBase: ({ onClick, id, toggleMenuId, isMenuFocused, className, handleKeys, onFocus, onBlur, children, isVisible, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
21
19
|
export { NavBarBase };
|
|
@@ -2,13 +2,17 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
import { getClassName } from "../../../utilities/helpers/getClassName";
|
|
4
4
|
const defaultClassName = "af-nav-container";
|
|
5
|
-
const NavBarBase = ({
|
|
5
|
+
const NavBarBase = ({ onClick, id = "mainmenu", toggleMenuId = "togglemenu", isMenuFocused, className, handleKeys, onFocus, onBlur, children, isVisible, }) => {
|
|
6
6
|
const componentClassName = getClassName({
|
|
7
7
|
baseClassName: defaultClassName,
|
|
8
|
-
modifiers: classModifier?.split(" "),
|
|
9
8
|
className,
|
|
10
9
|
});
|
|
11
|
-
|
|
10
|
+
const navClassName = getClassName({
|
|
11
|
+
baseClassName: "af-nav",
|
|
12
|
+
modifiers: [isVisible && "open"],
|
|
13
|
+
className: "af-drawer left",
|
|
14
|
+
});
|
|
15
|
+
return (_jsxs("div", { className: classNames("af-container", componentClassName), children: [isVisible ? (_jsx("button", { "aria-controls": id, "aria-haspopup": "true", type: "button", onClick: onClick, className: "mask fade", id: `open-${toggleMenuId}`, "aria-label": "Close Menu" })) : null, _jsxs("nav", { className: navClassName, role: "navigation", "aria-label": "Menu principal", children: [_jsxs("div", { className: "af-nav__aside-header", children: [_jsx("h4", { className: "af-nav__aside-title", children: "Menu" }), _jsx("button", { "aria-controls": id, "aria-haspopup": "true", onClick: onClick, type: "button", className: "af-nav__aside-close", id: `close-${toggleMenuId}`, "aria-label": "Close Menu", children: "\u00D7" })] }), _jsx("ul", { onKeyDown: (e) => {
|
|
12
16
|
e.preventDefault();
|
|
13
17
|
handleKeys(e.key);
|
|
14
18
|
}, onFocus: (e) => {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type ComponentProps, type ReactElement } from "react";
|
|
2
2
|
import { NavBarItemBase } from "./NavBarItemBase";
|
|
3
3
|
type ChildrenProps = {
|
|
4
|
-
classModifier?: string;
|
|
5
4
|
tabIndex?: number;
|
|
6
5
|
hasFocus?: boolean;
|
|
7
6
|
[key: string]: unknown;
|
|
@@ -9,6 +8,7 @@ type ChildrenProps = {
|
|
|
9
8
|
type Props = Omit<ComponentProps<typeof NavBarItemBase>, "handleKeys" | "isMenuOpen" | "position"> & {
|
|
10
9
|
ariaLabel?: string;
|
|
11
10
|
children?: ReactElement<ChildrenProps> | ReactElement<ChildrenProps>[];
|
|
11
|
+
active?: boolean;
|
|
12
12
|
};
|
|
13
|
-
declare const NavBarItem: ({ children, hasFocus, actionElt, ariaLabel, tabIndex, role, className, ...otherProps }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare const NavBarItem: ({ children, hasFocus, actionElt, ariaLabel, tabIndex, role, className, active, ...otherProps }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
export { NavBarItem };
|
|
@@ -2,8 +2,9 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import React, { useCallback, useState, } from "react";
|
|
3
3
|
import { getPosition } from "../NavBar.helpers";
|
|
4
4
|
import { NavBarItemBase } from "./NavBarItemBase";
|
|
5
|
+
import { getClassName } from "../../../../utilities";
|
|
5
6
|
const defaultClassName = "af-nav__item";
|
|
6
|
-
const NavBarItem = ({ children, hasFocus = false, actionElt, ariaLabel = "", tabIndex = -1, role = "menuitem", className =
|
|
7
|
+
const NavBarItem = ({ children, hasFocus = false, actionElt, ariaLabel = "", tabIndex = -1, role = "menuitem", className, active = false, ...otherProps }) => {
|
|
7
8
|
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
|
8
9
|
const [position, setPosition] = useState(0);
|
|
9
10
|
const moveBykey = useCallback((key) => {
|
|
@@ -44,11 +45,17 @@ const NavBarItem = ({ children, hasFocus = false, actionElt, ariaLabel = "", tab
|
|
|
44
45
|
}
|
|
45
46
|
}, [children, isMenuOpen, position, moveBykey, openMenu, closeMenu]);
|
|
46
47
|
const renderChild = useCallback((child, childIndex) => React.cloneElement(child, {
|
|
47
|
-
|
|
48
|
+
className: child.props.className,
|
|
49
|
+
"aria-current": childIndex === position && isMenuOpen ? "page" : undefined,
|
|
48
50
|
tabIndex: childIndex === position && isMenuOpen ? 0 : -1,
|
|
49
51
|
key: `child${childIndex}`,
|
|
50
52
|
hasFocus: hasFocus && position === childIndex && isMenuOpen,
|
|
51
53
|
}), [position, isMenuOpen, hasFocus]);
|
|
52
|
-
|
|
54
|
+
const componentClassName = getClassName({
|
|
55
|
+
baseClassName: defaultClassName,
|
|
56
|
+
modifiers: [active ? "active" : ""],
|
|
57
|
+
className,
|
|
58
|
+
});
|
|
59
|
+
return (_jsx(NavBarItemBase, { className: componentClassName, role: role, hasFocus: hasFocus, tabIndex: tabIndex, isMenuOpen: isMenuOpen, handleKeys: handleKeys, actionElt: actionElt, ...otherProps, children: children ? (_jsxs(_Fragment, { children: [_jsx("i", { className: "glyphicon glyphicon-arrow-xs-down" }, `icon${tabIndex}`), _jsx("ul", { className: "af-nav__list af-nav__list--children", role: "menu", "aria-label": ariaLabel, children: React.Children.map(children, renderChild) }, `list${tabIndex}`)] })) : null }));
|
|
53
60
|
};
|
|
54
61
|
export { NavBarItem };
|
|
@@ -4,7 +4,6 @@ type Props = HTMLAttributes<HTMLLIElement> & {
|
|
|
4
4
|
handleKeys: (event: KeyboardEvent<HTMLLIElement>) => void;
|
|
5
5
|
hasFocus?: boolean;
|
|
6
6
|
isMenuOpen?: boolean;
|
|
7
|
-
classModifier?: string;
|
|
8
7
|
};
|
|
9
|
-
export declare const NavBarItemBase: ({ tabIndex, role, children, hasFocus, handleKeys, isMenuOpen, className,
|
|
8
|
+
export declare const NavBarItemBase: ({ tabIndex, role, children, hasFocus, handleKeys, isMenuOpen, className, actionElt, ...otherProps }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
10
9
|
export {};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useMemo, useRef, } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { getClassName } from "../../../../utilities";
|
|
4
4
|
import { handleLinkFocus } from "./NavBarItemBase.helpers";
|
|
5
|
-
export const NavBarItemBase = ({ tabIndex = -1, role = "menuitem", children, hasFocus, handleKeys, isMenuOpen, className,
|
|
6
|
-
const componentClassName =
|
|
5
|
+
export const NavBarItemBase = ({ tabIndex = -1, role = "menuitem", children, hasFocus, handleKeys, isMenuOpen, className, actionElt, ...otherProps }) => {
|
|
6
|
+
const componentClassName = getClassName({
|
|
7
|
+
baseClassName: "af-nav__item",
|
|
8
|
+
className,
|
|
9
|
+
});
|
|
7
10
|
const ref = useRef(null);
|
|
8
11
|
useEffect(() => {
|
|
9
12
|
handleLinkFocus(ref?.current, hasFocus, isMenuOpen);
|
|
@@ -13,16 +13,6 @@ type Props = {
|
|
|
13
13
|
* Children elements to be rendered next to the user's name and role
|
|
14
14
|
*/
|
|
15
15
|
children?: ReactNode;
|
|
16
|
-
/**
|
|
17
|
-
* Class modifier to apply additional styles\
|
|
18
|
-
* @example
|
|
19
|
-
* ```tsx
|
|
20
|
-
* <User classModifier="custom-class" />
|
|
21
|
-
* ```
|
|
22
|
-
* This will apply the class `af-info-user--custom-class` to the component.
|
|
23
|
-
* @deprecated Use `className` instead.
|
|
24
|
-
*/
|
|
25
|
-
classModifier?: string;
|
|
26
16
|
/**
|
|
27
17
|
* classNames to override completely the component's style
|
|
28
18
|
*/
|
|
@@ -57,5 +47,5 @@ type Props = {
|
|
|
57
47
|
*/
|
|
58
48
|
title?: string;
|
|
59
49
|
};
|
|
60
|
-
declare const User: ({ children,
|
|
50
|
+
declare const User: ({ children, className, href, name, path, profile, onClick, title, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
61
51
|
export { User };
|
|
@@ -3,10 +3,9 @@ import "@axa-fr/canopee-css/distributeur/Layout/Header/User/User.css";
|
|
|
3
3
|
import { getClassName } from "../../../utilities/helpers/getClassName";
|
|
4
4
|
import { InnerUser } from "./InnerUser";
|
|
5
5
|
const defaultClassName = "af-info-user";
|
|
6
|
-
const User = ({ children,
|
|
6
|
+
const User = ({ children, className, href, name, path, profile, onClick, title = "Voir mon profil", }) => {
|
|
7
7
|
const componentClassName = getClassName({
|
|
8
8
|
baseClassName: defaultClassName,
|
|
9
|
-
modifiers: classModifier?.split(" "),
|
|
10
9
|
className,
|
|
11
10
|
});
|
|
12
11
|
return (_jsxs("div", { className: componentClassName, children: [href ? (_jsx("a", { "aria-label": "user info link", className: `${defaultClassName}__link`, href: href, title: title, onClick: (event) => onClick && onClick({ path, event }), children: _jsx(InnerUser, { name: name, profile: profile }) })) : (_jsx(InnerUser, { name: name, profile: profile })), children] }));
|