@axa-fr/design-system-look-and-feel-react 1.0.5-ci.8 → 1.0.5-ci.86

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.
Files changed (88) hide show
  1. package/dist/AccordionCore/AccordionCore.js +1 -1
  2. package/dist/Alert/Alert.d.ts +2 -2
  3. package/dist/Alert/Alert.js +6 -6
  4. package/dist/Card/Card.js +1 -1
  5. package/dist/Divider/Divider.js +1 -1
  6. package/dist/Form/Checkbox/Checkbox.js +2 -2
  7. package/dist/Form/Checkbox/CheckboxSelect.d.ts +3 -3
  8. package/dist/Form/Checkbox/CheckboxSelect.js +5 -2
  9. package/dist/Form/FileUpload/FileUpload.d.ts +5 -4
  10. package/dist/Form/FileUpload/FileUpload.js +7 -5
  11. package/dist/Form/Radio/Radio.js +2 -2
  12. package/dist/Form/Radio/RadioSelect.d.ts +1 -1
  13. package/dist/Form/Radio/RadioSelect.js +5 -2
  14. package/dist/Form/Select/Select.d.ts +5 -22
  15. package/dist/Form/Select/Select.js +11 -23
  16. package/dist/Form/Text/Text.d.ts +3 -0
  17. package/dist/Form/Text/Text.js +7 -3
  18. package/dist/Form/TextArea/TextArea.js +2 -2
  19. package/dist/Form/core/FieldForm.d.ts +1 -1
  20. package/dist/Form/core/FieldForm.js +3 -2
  21. package/dist/IconBg/IconBg.js +1 -1
  22. package/dist/Layout/Header/Header.d.ts +3 -3
  23. package/dist/Layout/Header/Header.js +2 -2
  24. package/dist/Layout/Header/NavBar/NavBar.d.ts +2 -2
  25. package/dist/Layout/Header/NavBar/NavBar.js +3 -3
  26. package/dist/Link/Link.js +1 -1
  27. package/dist/List/ClickList/ClickItem/ClickItem.js +1 -1
  28. package/dist/List/ContentItemDuo/ContentItemDuo.d.ts +2 -1
  29. package/dist/List/ContentItemDuo/ContentItemDuo.js +3 -3
  30. package/dist/List/ContentItemMono/ContentItemMono.js +1 -1
  31. package/dist/Modal/Modal.d.ts +12 -0
  32. package/dist/Modal/Modal.js +10 -0
  33. package/dist/Modal/ModalCore.d.ts +11 -0
  34. package/dist/Modal/ModalCore.js +6 -0
  35. package/dist/Modal/components/ModalCoreBody.d.ts +2 -0
  36. package/dist/Modal/components/ModalCoreBody.js +2 -0
  37. package/dist/Modal/components/ModalCoreFooter.d.ts +2 -0
  38. package/dist/Modal/components/ModalCoreFooter.js +2 -0
  39. package/dist/Modal/components/ModalCoreHeader.d.ts +12 -0
  40. package/dist/Modal/components/ModalCoreHeader.js +8 -0
  41. package/dist/Modal/index.d.ts +5 -0
  42. package/dist/Modal/index.js +5 -0
  43. package/dist/Skeleton/Skeleton.d.ts +1 -1
  44. package/dist/SkeletonList/SkeletonList.d.ts +1 -1
  45. package/dist/Stepper/Stepper.d.ts +1 -1
  46. package/dist/Stepper/Stepper.js +3 -3
  47. package/dist/Tag/Tag.js +1 -1
  48. package/dist/Title/Title.js +1 -1
  49. package/dist/Title/TitleWithSubtitles.d.ts +1 -1
  50. package/dist/index.d.ts +7 -3
  51. package/dist/index.js +6 -2
  52. package/dist/utilities/helpers/getComponentClassName.d.ts +1 -1
  53. package/dist/utilities/helpers/getComponentClassName.js +7 -8
  54. package/package.json +21 -66
  55. package/dist/Form/Select/CustomOption.d.ts +0 -4
  56. package/dist/Form/Select/CustomOption.js +0 -8
  57. package/dist/Form/Select/DropdownIndicator.d.ts +0 -4
  58. package/dist/Form/Select/DropdownIndicator.js +0 -11
  59. package/dist/Grid/components/Card.d.ts +0 -3
  60. package/dist/Grid/components/Card.js +0 -2
  61. package/dist/Grid/components/Contacts.d.ts +0 -1
  62. package/dist/Grid/components/Contacts.js +0 -9
  63. package/dist/Grid/components/MainTitle.d.ts +0 -1
  64. package/dist/Grid/components/MainTitle.js +0 -4
  65. package/dist/Grid/components/MyFooter.d.ts +0 -1
  66. package/dist/Grid/components/MyFooter.js +0 -31
  67. package/dist/Grid/components/MyHeader.d.ts +0 -1
  68. package/dist/Grid/components/MyHeader.js +0 -9
  69. package/dist/Grid/components/MyList.d.ts +0 -1
  70. package/dist/Grid/components/MyList.js +0 -3
  71. package/dist/Grid/components/Offsets.d.ts +0 -1
  72. package/dist/Grid/components/Offsets.js +0 -7
  73. package/dist/Grid/renderExampleForm.d.ts +0 -1
  74. package/dist/Grid/renderExampleForm.js +0 -30
  75. package/dist/Grid/renderExamplePage.d.ts +0 -1
  76. package/dist/Grid/renderExamplePage.js +0 -9
  77. package/dist/Grid/renderWireframe.d.ts +0 -1
  78. package/dist/Grid/renderWireframe.js +0 -5
  79. package/dist/ModalClient/Modal.container.d.ts +0 -4
  80. package/dist/ModalClient/Modal.container.js +0 -45
  81. package/dist/ModalClient/Modal.d.ts +0 -4
  82. package/dist/ModalClient/Modal.hook.d.ts +0 -6
  83. package/dist/ModalClient/Modal.hook.js +0 -25
  84. package/dist/ModalClient/Modal.js +0 -6
  85. package/dist/ModalClient/index.d.ts +0 -1
  86. package/dist/ModalClient/index.js +0 -1
  87. package/dist/ModalClient/type.d.ts +0 -38
  88. package/dist/ModalClient/type.js +0 -1
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useMemo, } from "react";
3
3
  import { getComponentClassName } from "../utilities";
4
4
  export const AccordionCore = ({ summary, children, className, classModifier, summaryProps, isOpen, onClick, ...detailsProps }) => {
5
- const componentClassName = useMemo(() => getComponentClassName(className, classModifier, "af-accordion"), [classModifier, className]);
5
+ const componentClassName = useMemo(() => getComponentClassName("af-accordion", className, classModifier), [classModifier, className]);
6
6
  const handleToggle = useCallback((event) => {
7
7
  if (onClick) {
8
8
  event.preventDefault();
@@ -1,7 +1,7 @@
1
- import { ComponentPropsWithoutRef, PropsWithChildren, ReactElement } from "react";
2
1
  import "@axa-fr/design-system-look-and-feel-css/dist/Alert/Alert.scss";
3
- import { Link } from "../Link/Link";
2
+ import { ComponentPropsWithoutRef, PropsWithChildren, ReactElement } from "react";
4
3
  import { ButtonClient } from "../Button/Button";
4
+ import { Link } from "../Link/Link";
5
5
  type Headings = "h2" | "h3" | "h4" | "h5" | "h6";
6
6
  export declare const alertTypes: {
7
7
  readonly validation: "validation";
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useMemo, } from "react";
3
- import wbIncandescentOutlined from "@material-symbols/svg-400/outlined/wb_incandescent.svg";
4
- import infoIcon from "@material-symbols/svg-400/outlined/info.svg";
2
+ import "@axa-fr/design-system-look-and-feel-css/dist/Alert/Alert.scss";
3
+ import checkCircleOutline from "@material-symbols/svg-400/outlined/check_circle.svg";
5
4
  import errorIcon from "@material-symbols/svg-400/outlined/emergency_home.svg";
6
5
  import errorOutline from "@material-symbols/svg-400/outlined/error.svg";
7
- import checkCircleOutline from "@material-symbols/svg-400/outlined/check_circle.svg";
8
- import "@axa-fr/design-system-look-and-feel-css/dist/Alert/Alert.scss";
6
+ import infoIcon from "@material-symbols/svg-400/outlined/info.svg";
7
+ import wbIncandescentOutlined from "@material-symbols/svg-400/outlined/wb_incandescent.svg";
8
+ import { useMemo, } from "react";
9
9
  import { Svg } from "../Svg";
10
10
  export const alertTypes = {
11
11
  validation: "validation",
@@ -23,5 +23,5 @@ const getIconFromType = (type) => ({
23
23
  })[type] || wbIncandescentOutlined;
24
24
  export const Alert = ({ type = alertTypes.information, title, children, action, iconSize = 24, heading: Heading = "h4", }) => {
25
25
  const icon = useMemo(() => getIconFromType(type), [type]);
26
- return (_jsxs("div", { className: `af-alert af-alert--${type}`, role: "alert", children: [_jsx(Svg, { src: icon, width: iconSize, height: iconSize, className: "af-alert__icon", "aria-hidden": true }), _jsxs("div", { className: "af-alert-client__content", children: [title && _jsx(Heading, { className: "af-alert__title", children: title }), children, action && _jsx("p", { className: "af-alert__action", children: action })] })] }));
26
+ return (_jsxs("div", { className: `af-alert af-alert--${type}`, role: "alert", children: [_jsx(Svg, { src: icon, width: iconSize, height: iconSize, className: "af-alert__icon", "aria-hidden": true }), _jsxs("div", { className: "af-alert-client__content", children: [title && _jsx(Heading, { className: "af-alert__title", children: title }), children, action && _jsx("div", { className: "af-alert__action", children: action })] })] }));
27
27
  };
package/dist/Card/Card.js CHANGED
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useMemo } from "react";
3
3
  import { getComponentClassName } from "../utilities";
4
4
  export const Card = ({ children, className, classModifier, onClick, ...otherProps }) => {
5
- const componentClassName = useMemo(() => getComponentClassName(className, classModifier, "af-card"), [className, classModifier]);
5
+ const componentClassName = useMemo(() => getComponentClassName("af-card", className, classModifier), [className, classModifier]);
6
6
  const Component = useMemo(() => (onClick ? "button" : "section"), [onClick]);
7
7
  return (_jsx(Component, { className: componentClassName, ...(onClick ? { type: "button", onClick } : {}), ...otherProps, children: children }));
8
8
  };
@@ -2,6 +2,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useMemo } from "react";
3
3
  import { getComponentClassName } from "../utilities";
4
4
  export const Divider = ({ className, classModifier }) => {
5
- const componentClassName = useMemo(() => getComponentClassName(className, classModifier, "af-divider"), [className, classModifier]);
5
+ const componentClassName = useMemo(() => getComponentClassName("af-divider", className, classModifier), [className, classModifier]);
6
6
  return _jsx("hr", { className: componentClassName });
7
7
  };
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import "@axa-fr/design-system-look-and-feel-css/dist/Form/Checkbox/Checkbox.scss";
3
3
  import checkBoxIcon from "@material-symbols/svg-400/outlined/check_box-fill.svg";
4
4
  import checkBoxOutlineBlankIcon from "@material-symbols/svg-400/outlined/check_box_outline_blank.svg";
@@ -10,7 +10,7 @@ const Checkbox = forwardRef(({ label, errorMessage, className, ...inputProps },
10
10
  const idError = useId();
11
11
  let inputId = useId();
12
12
  inputId = inputProps.id || inputId;
13
- return (_jsxs(_Fragment, { children: [_jsx("div", { className: classNames("af-checkbox", className), children: _jsxs("label", { htmlFor: inputId, children: [_jsx("input", { ref: ref, ...inputProps, type: "checkbox", id: inputId, "aria-errormessage": idError, "aria-invalid": !!errorMessage }), _jsxs("div", { className: "af-checkbox__icons", children: [_jsx(Svg, { src: checkBoxOutlineBlankIcon, className: "af-checkbox__unchecked" }), _jsx(Svg, { src: checkBoxIcon, className: "af-checkbox__checked" })] }), label] }, inputProps.name) }), errorMessage && (_jsxs("div", { className: "af-checkbox__error", "aria-live": "assertive", id: idError, children: [_jsx(Svg, { src: errorOutline }), errorMessage] }))] }));
13
+ return (_jsxs("div", { children: [_jsx("div", { className: classNames("af-checkbox", className), children: _jsxs("label", { htmlFor: inputId, children: [_jsx("input", { ref: ref, ...inputProps, type: "checkbox", id: inputId, "aria-errormessage": idError, "aria-invalid": !!errorMessage }), _jsxs("div", { className: "af-checkbox__icons", children: [_jsx(Svg, { src: checkBoxOutlineBlankIcon, className: "af-checkbox__unchecked" }), _jsx(Svg, { src: checkBoxIcon, className: "af-checkbox__checked" })] }), label] }, inputProps.name) }), errorMessage && (_jsxs("div", { className: "af-checkbox__error", "aria-live": "assertive", id: idError, children: [_jsx(Svg, { src: errorOutline }), errorMessage] }))] }));
14
14
  });
15
15
  Checkbox.displayName = "Checkbox";
16
16
  export { Checkbox };
@@ -1,6 +1,6 @@
1
1
  import "@axa-fr/design-system-look-and-feel-css/dist/Form/Checkbox/Checkbox.scss";
2
- import React, { type ReactNode } from "react";
3
- type CheckboxProps = {
2
+ import React, { ComponentPropsWithRef, type ReactNode } from "react";
3
+ type CheckboxProps = ComponentPropsWithRef<"input"> & {
4
4
  type: "vertical" | "horizontal";
5
5
  labelGroup?: string;
6
6
  descriptionGroup?: string;
@@ -14,5 +14,5 @@ type CheckboxProps = {
14
14
  errorMessage?: string;
15
15
  onChange?: React.ChangeEventHandler;
16
16
  };
17
- export declare const CheckboxSelect: ({ labelGroup, descriptionGroup, isRequired, options, errorMessage, onChange, type, }: CheckboxProps) => import("react/jsx-runtime").JSX.Element;
17
+ export declare const CheckboxSelect: ({ className, labelGroup, descriptionGroup, isRequired, options, errorMessage, onChange, type, }: CheckboxProps) => import("react/jsx-runtime").JSX.Element;
18
18
  export {};
@@ -5,7 +5,10 @@ import checkBoxOutlineBlankIcon from "@material-symbols/svg-400/outlined/check_b
5
5
  import errorOutline from "@material-symbols/svg-400/outlined/error.svg";
6
6
  import { useId } from "react";
7
7
  import { Svg } from "../../Svg";
8
- export const CheckboxSelect = ({ labelGroup, descriptionGroup, isRequired, options, errorMessage, onChange, type = "vertical", }) => {
8
+ import { getComponentClassName } from "../../utilities/helpers/getComponentClassName";
9
+ export const CheckboxSelect = ({ className, labelGroup, descriptionGroup, isRequired, options, errorMessage, onChange, type = "vertical", }) => {
10
+ const componentClassName = getComponentClassName("af-checkbox__container", className);
11
+ const checkboxGroupClassName = getComponentClassName(`af-checkbox af-checkbox-select af-checkbox-select--${type}`, className);
9
12
  const optionId = useId();
10
- return (_jsxs("div", { className: "af-checkbox__container", children: [_jsxs("div", { className: "af-checkbox__label-container", children: [labelGroup && (_jsxs("span", { className: "af-checkbox__label", id: optionId, children: [labelGroup, isRequired && _jsx("span", { "aria-hidden": "true", children: "\u00A0*" })] })), descriptionGroup && (_jsx("span", { className: "af-checkbox__description", children: descriptionGroup }))] }), _jsx("div", { role: "group", className: `af-checkbox af-checkbox-select af-checkbox-select--${type}`, children: options.map(({ label, description, subtitle, icon, ...inputProps }) => (_jsxs("label", { htmlFor: `id-${inputProps.name}`, children: [_jsx("input", { type: "checkbox", ...inputProps, id: `id-${inputProps.name}`, onChange: onChange, "aria-invalid": Boolean(errorMessage) && !inputProps.disabled }), _jsxs("div", { className: "af-checkbox__icons", children: [_jsx(Svg, { src: checkBoxOutlineBlankIcon, className: "af-checkbox__unchecked" }), _jsx(Svg, { src: checkBoxIcon, className: "af-checkbox__checked" })] }), _jsxs("div", { className: "af-checkbox__content", children: [icon, _jsxs("div", { className: "af-checkbox__content-description", children: [_jsx("span", { children: label }), description && _jsx("span", { children: description }), subtitle && _jsx("span", { children: subtitle })] })] })] }, inputProps.name))) }), errorMessage && (_jsxs("div", { className: "af-checkbox__error", "aria-live": "assertive", children: [_jsx(Svg, { src: errorOutline }), errorMessage] }))] }));
13
+ return (_jsxs("div", { className: componentClassName, children: [_jsxs("div", { className: "af-checkbox__label-container", children: [labelGroup && (_jsxs("span", { className: "af-checkbox__label", id: optionId, children: [labelGroup, isRequired && _jsx("span", { "aria-hidden": "true", children: "\u00A0*" })] })), descriptionGroup && (_jsx("span", { className: "af-checkbox__description", children: descriptionGroup }))] }), _jsx("div", { role: "group", className: checkboxGroupClassName, children: options.map(({ label, description, subtitle, icon, ...inputProps }) => (_jsxs("label", { htmlFor: `id-${inputProps.name}`, children: [_jsx("input", { type: "checkbox", ...inputProps, id: `id-${inputProps.name}`, onChange: onChange, "aria-invalid": Boolean(errorMessage) && !inputProps.disabled }), _jsxs("div", { className: "af-checkbox__icons", children: [_jsx(Svg, { src: checkBoxOutlineBlankIcon, className: "af-checkbox__unchecked" }), _jsx(Svg, { src: checkBoxIcon, className: "af-checkbox__checked" })] }), _jsxs("div", { className: "af-checkbox__content", children: [icon, _jsxs("div", { className: "af-checkbox__content-description", children: [_jsx("span", { children: label }), description && _jsx("span", { children: description }), subtitle && _jsx("span", { children: subtitle })] })] })] }, inputProps.name))) }), errorMessage && (_jsxs("div", { className: "af-checkbox__error", "aria-live": "assertive", children: [_jsx(Svg, { src: errorOutline }), errorMessage] }))] }));
11
14
  };
@@ -7,8 +7,8 @@ type Props = Omit<ComponentPropsWithRef<"input">, "required"> & {
7
7
  dropzoneDescription?: string;
8
8
  instructions?: string;
9
9
  required?: boolean;
10
- globalError: string;
11
- errors: Array<{
10
+ globalError?: string;
11
+ errors?: Array<{
12
12
  id?: string | undefined;
13
13
  message: string;
14
14
  }>;
@@ -18,15 +18,16 @@ type Props = Omit<ComponentPropsWithRef<"input">, "required"> & {
18
18
  size: number;
19
19
  isLoading: boolean;
20
20
  }>;
21
- accept: string;
21
+ accept?: string;
22
22
  isMobile?: boolean;
23
+ withPadding?: boolean;
23
24
  onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
24
25
  onDrop?: (event: React.DragEvent<HTMLDivElement>) => void;
25
26
  onView?: (id: string) => void;
26
27
  onDelete?: (id: string) => void;
27
28
  };
28
29
  declare const FileUpload: {
29
- ({ id, label, buttonLabel, instructions, dropzoneDescription, required, files, errors, globalError, isMobile, onView, onDelete, ...otherProps }: Props): import("react/jsx-runtime").JSX.Element;
30
+ ({ id, label, buttonLabel, instructions, dropzoneDescription, required, files, errors, globalError, isMobile, withPadding, onView, onDelete, ...otherProps }: Props): import("react/jsx-runtime").JSX.Element;
30
31
  displayName: string;
31
32
  };
32
33
  export { FileUpload };
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useId } from "react";
3
3
  import "@axa-fr/design-system-look-and-feel-css/dist/Form/FileUpload/FileUpload.scss";
4
4
  import visibility from "@material-symbols/svg-400/outlined/visibility-fill.svg";
@@ -23,7 +23,7 @@ function getReadableFileSizeString(fileSizeInBytes) {
23
23
  } while (fileSizeInBytesCopy > 1024);
24
24
  return Math.max(fileSizeInBytesCopy, 0.1).toFixed(1) + byteUnits[i];
25
25
  }
26
- const FileUpload = ({ id, label, buttonLabel, instructions, dropzoneDescription, required, files, errors, globalError, isMobile, onView, onDelete, ...otherProps }) => {
26
+ const FileUpload = ({ id, label, buttonLabel, instructions, dropzoneDescription, required, files, errors, globalError, isMobile, withPadding = false, onView, onDelete, ...otherProps }) => {
27
27
  const idError = useId();
28
28
  const getIcon = (isInError, isLoading) => {
29
29
  if (isInError) {
@@ -34,10 +34,12 @@ const FileUpload = ({ id, label, buttonLabel, instructions, dropzoneDescription,
34
34
  }
35
35
  return (_jsx(Svg, { src: check, className: "af-form__file-title-container-icon-success" }));
36
36
  };
37
- return (_jsxs(_Fragment, { children: [_jsxs("label", { className: "af-form__group--label", htmlFor: id, children: [label, " ", required ? "*" : ""] }), _jsxs("div", { className: classNames("af-form__file-input", globalError && "af-form__file-input--error", (isMobile || !dropzoneDescription) && "is-mobile"), children: [_jsx("input", { type: "file", name: "file-input", id: id, "aria-errormessage": idError, "aria-invalid": Boolean(globalError), ...otherProps }), dropzoneDescription && (_jsxs("div", { className: "af-form__file-input-dropdown-text", children: [_jsx("p", { children: dropzoneDescription }), _jsx("p", { children: "ou" })] })), _jsx(Button, { variant: Variants.tertiary, onClick: () => document.getElementById(id)?.click(), iconLeft: _jsx(Svg, { src: plus, className: "af-form__file-input-icon" }), children: buttonLabel })] }), globalError && _jsx(InputError, { id: idError, message: globalError }), _jsx("small", { className: "af-form__file-input-help", children: instructions }), _jsx("div", { className: "custom-table-file af-file-table", children: _jsx("ul", { className: "af-form__file-list", children: files.map(({ id: fileId, name, size, isLoading }) => {
37
+ return (_jsxs("div", { children: [_jsxs("label", { className: "af-form__group--label", htmlFor: id, children: [label, " ", required ? "*" : ""] }), _jsxs("div", { className: classNames("af-form__file-input", globalError && "af-form__file-input--error", (isMobile || (!withPadding && !dropzoneDescription)) && "is-mobile"), children: [_jsx("input", { type: "file", name: "file-input", id: id, "aria-errormessage": idError, "aria-invalid": Boolean(globalError), ...otherProps }), dropzoneDescription && (_jsxs("div", { className: "af-form__file-input-dropdown-text", children: [_jsx("p", { children: dropzoneDescription }), _jsx("p", { children: "ou" })] })), _jsx(Button, { variant: Variants.tertiary, onClick: () => document.getElementById(id)?.click(), iconLeft: _jsx(Svg, { src: plus, className: "af-form__file-input-icon" }), children: buttonLabel })] }), globalError && _jsx(InputError, { id: idError, message: globalError }), _jsx("small", { className: "af-form__file-input-help", children: instructions }), _jsx("div", { className: "custom-table-file af-file-table", children: _jsx("ul", { className: "af-form__file-list", children: files.map(({ id: fileId, name, size, isLoading }) => {
38
38
  const effectiveSize = getReadableFileSizeString(size);
39
- const isInError = errors.some((fileError) => fileError.id === fileId);
40
- const errorMessage = errors.find((fileError) => fileError.id === fileId)?.message;
39
+ const isInError = errors
40
+ ? errors.some((fileError) => fileError.id === fileId)
41
+ : false;
42
+ const errorMessage = errors?.find((fileError) => fileError.id === fileId)?.message;
41
43
  return (_jsxs("li", { className: "af-form__file-line", children: [_jsxs("div", { className: `af-form__file-line-container ${isInError ? "af-form__file-line-container--error" : ""}`, children: [_jsxs("div", { className: "af-form__file-title", children: [getIcon(isInError, isLoading), _jsxs("div", { children: [_jsx("span", { className: "af-form__file-name", children: name }), _jsx("span", { className: "af-form__file-size", children: effectiveSize })] })] }), _jsxs("div", { className: "af-form__file-actions", children: [onView && (_jsx(Svg, { tabIndex: 0, role: "button", "aria-label": "Visualiser", onClick: () => onView(fileId), onKeyDown: (e) => {
42
44
  if (e.key === "Enter") {
43
45
  onView(fileId);
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import "@axa-fr/design-system-look-and-feel-css/dist/Form/Radio/Radio.scss";
3
3
  import radioIcon from "@material-symbols/svg-400/outlined/radio_button_checked.svg";
4
4
  import radioOutlineBlankIcon from "@material-symbols/svg-400/outlined/radio_button_unchecked.svg";
@@ -9,7 +9,7 @@ const Radio = forwardRef(({ label, errorMessage, ...inputProps }, ref) => {
9
9
  let inputId = useId();
10
10
  inputId = inputProps.id || inputId;
11
11
  const idError = useId();
12
- return (_jsxs(_Fragment, { children: [_jsx("div", { className: "af-radio", role: "radiogroup", "aria-invalid": Boolean(errorMessage), "aria-errormessage": idError, children: _jsxs("label", { htmlFor: inputId, children: [_jsx("input", { ref: ref, ...inputProps, type: "radio", id: inputId }), _jsxs("div", { className: "af-radio__icons", children: [_jsx(Svg, { src: radioOutlineBlankIcon, className: "af-radio__unchecked" }), _jsx(Svg, { src: radioIcon, className: "af-radio__checked" })] }), label] }, inputProps.name) }), errorMessage && _jsx(InputError, { id: idError, message: errorMessage })] }));
12
+ return (_jsxs("div", { children: [_jsx("div", { className: "af-radio", role: "radiogroup", "aria-invalid": Boolean(errorMessage), "aria-errormessage": idError, children: _jsxs("label", { htmlFor: inputId, children: [_jsx("input", { ref: ref, ...inputProps, type: "radio", id: inputId }), _jsxs("div", { className: "af-radio__icons", children: [_jsx(Svg, { src: radioOutlineBlankIcon, className: "af-radio__unchecked" }), _jsx(Svg, { src: radioIcon, className: "af-radio__checked" })] }), label] }, inputProps.name) }), errorMessage && _jsx(InputError, { id: idError, message: errorMessage })] }));
13
13
  });
14
14
  Radio.displayName = "Radio";
15
15
  export { Radio };
@@ -1,6 +1,6 @@
1
1
  import "@axa-fr/design-system-look-and-feel-css/dist/Form/Radio/Radio.scss";
2
2
  import React, { ComponentPropsWithRef, ReactNode } from "react";
3
- type RadioSelectProps = {
3
+ type RadioSelectProps = ComponentPropsWithRef<"input"> & {
4
4
  type: "vertical" | "horizontal";
5
5
  label?: string;
6
6
  description?: string;
@@ -5,7 +5,10 @@ import radioOutlineBlankIcon from "@material-symbols/svg-400/outlined/radio_butt
5
5
  import { forwardRef, useCallback, useId, } from "react";
6
6
  import { Svg } from "../../Svg";
7
7
  import { InputError } from "../InputError";
8
- export const RadioSelect = forwardRef(({ id, label, description, options, errorMessage, onChange, type = "vertical", name, value, isDisabled, isRequired, ...rest }, ref) => {
8
+ import { getComponentClassName } from "../../utilities/helpers/getComponentClassName";
9
+ export const RadioSelect = forwardRef(({ className, id, label, description, options, errorMessage, onChange, type = "vertical", name, value, isDisabled, isRequired, ...rest }, ref) => {
10
+ const componentClassName = getComponentClassName("af-radio__container", className);
11
+ const radioGroupClassName = getComponentClassName(`af-radio af-radio-select af-radio-select--${type}`, className);
9
12
  const generatedId = useId();
10
13
  const optionId = id || generatedId;
11
14
  const getRef = useCallback((index, reference, val, inputVal) => {
@@ -14,6 +17,6 @@ export const RadioSelect = forwardRef(({ id, label, description, options, errorM
14
17
  }
15
18
  return null;
16
19
  }, []);
17
- return (_jsxs("div", { className: "af-radio__container", children: [_jsxs("div", { className: "af-radio__label-container", children: [label && (_jsxs("span", { className: "af-radio__label", id: optionId, children: [label, isRequired && _jsx("span", { "aria-hidden": "true", children: "\u00A0*" })] })), description && (_jsx("span", { className: "af-radio__description", children: description }))] }), _jsx("div", { ...rest, role: "radiogroup", className: `af-radio af-radio-select af-radio-select--${type}`, "aria-invalid": Boolean(errorMessage), "aria-labelledby": optionId, "aria-errormessage": `${optionId}-error`, children: options.map(({ label: inputLabel, description: inputDescription, subtitle, icon, disabled: inputDisabled, ...inputProps }, idx) => (_jsxs("label", { htmlFor: `${optionId}-${inputLabel}`, children: [_jsx("input", { type: "radio", ...(isDisabled || inputDisabled ? { disabled: true } : null), ...inputProps, name: name, id: `${optionId}-${inputLabel}`, onChange: onChange, "aria-checked": value === inputProps.value, checked: value === inputProps.value, ref: getRef(idx, ref, value, inputProps.value) }), _jsxs("div", { className: "af-radio__icons", children: [_jsx(Svg, { src: radioOutlineBlankIcon, className: "af-radio__unchecked" }), _jsx(Svg, { src: radioIcon, className: "af-radio__checked" })] }), _jsxs("div", { className: "af-radio__content", children: [icon, _jsxs("div", { className: "af-radio__content-description", children: [_jsx("span", { children: inputLabel }), inputDescription && _jsx("span", { children: inputDescription }), subtitle && _jsx("span", { children: subtitle })] })] })] }, inputLabel))) }), errorMessage && (_jsx(InputError, { id: `${optionId}-error`, message: errorMessage }))] }));
20
+ return (_jsxs("div", { className: componentClassName, children: [_jsxs("div", { className: "af-radio__label-container", children: [label && (_jsxs("span", { className: "af-radio__label", id: optionId, children: [label, isRequired && _jsx("span", { "aria-hidden": "true", children: "\u00A0*" })] })), description && (_jsx("span", { className: "af-radio__description", children: description }))] }), _jsx("div", { ...rest, role: "radiogroup", className: radioGroupClassName, "aria-invalid": Boolean(errorMessage), "aria-labelledby": optionId, "aria-errormessage": `${optionId}-error`, children: options.map(({ label: inputLabel, description: inputDescription, subtitle, icon, disabled: inputDisabled, ...inputProps }, idx) => (_jsxs("label", { htmlFor: `${optionId}-${inputLabel}`, children: [_jsx("input", { type: "radio", ...(isDisabled || inputDisabled ? { disabled: true } : null), ...inputProps, name: name, id: `${optionId}-${inputLabel}`, onChange: onChange, "aria-checked": value === inputProps.value, checked: value === inputProps.value, ref: getRef(idx, ref, value, inputProps.value) }), _jsxs("div", { className: "af-radio__icons", children: [_jsx(Svg, { src: radioOutlineBlankIcon, className: "af-radio__unchecked" }), _jsx(Svg, { src: radioIcon, className: "af-radio__checked" })] }), _jsxs("div", { className: "af-radio__content", children: [icon, _jsxs("div", { className: "af-radio__content-description", children: [_jsx("span", { children: inputLabel }), inputDescription && _jsx("span", { children: inputDescription }), subtitle && _jsx("span", { children: subtitle })] })] })] }, inputLabel))) }), errorMessage && (_jsx(InputError, { id: `${optionId}-error`, message: errorMessage }))] }));
18
21
  });
19
22
  RadioSelect.displayName = "RadioSelect";
@@ -1,27 +1,10 @@
1
1
  import "@axa-fr/design-system-look-and-feel-css/dist/Form/Select/Select.scss";
2
- import ReactSelect, { ActionMeta, SingleValue } from "react-select";
3
- import { ComponentPropsWithoutRef, PropsWithChildren } from "react";
4
- type Option = {
5
- label: string;
6
- value: string | number;
7
- };
8
- type Props = Omit<ComponentPropsWithoutRef<ReactSelect>, "placeholder" | "noOptionsMessage"> & {
9
- id: string;
10
- label: string;
11
- options: {
12
- label: string;
13
- value?: string | number | readonly string[];
14
- }[];
15
- value: Option | null;
2
+ import { ComponentPropsWithRef } from "react";
3
+ type Props = ComponentPropsWithRef<"select"> & {
4
+ id?: string;
5
+ label?: string;
16
6
  errorLabel?: string;
17
7
  placeholder?: string;
18
- noOptionsMessage?: string;
19
- onChange: (newValue: SingleValue<Option>, actionMeta: ActionMeta<string>) => void;
20
- disabled?: boolean;
21
- required?: boolean;
22
- };
23
- declare const Select: {
24
- ({ id, required, disabled, label, errorLabel, noOptionsMessage, ...otherProps }: PropsWithChildren<Props>): import("react/jsx-runtime").JSX.Element;
25
- displayName: string;
26
8
  };
9
+ declare const Select: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLSelectElement>>;
27
10
  export { Select };
@@ -1,27 +1,15 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import "@axa-fr/design-system-look-and-feel-css/dist/Form/Select/Select.scss";
3
- import ErrorOutline from "@material-symbols/svg-400/outlined/error.svg";
4
- import ReactSelect from "react-select";
3
+ import { forwardRef, useId } from "react";
5
4
  import classNames from "classnames";
6
- import { DropdownIndicator } from "./DropdownIndicator";
7
- import { Svg } from "../../Svg";
8
- import { CustomOption } from "./CustomOption";
9
- const Select = ({ id, required, disabled, label, errorLabel, noOptionsMessage, ...otherProps }) => {
10
- return (_jsxs(_Fragment, { children: [label && (_jsxs("label", { id: `${id}__label`, htmlFor: `${id}__input`, className: "af-form__select-label", children: [label, required && _jsx("span", { children: " *" })] })), _jsx(ReactSelect, { inputId: `${id}__input`, "aria-labelledby": `${id}__label`, "aria-errormessage": `${id}__error`, "aria-invalid": Boolean(errorLabel), unstyled: true, isDisabled: disabled, noOptionsMessage: () => noOptionsMessage || "Aucun résultat", components: {
11
- DropdownIndicator,
12
- Option: CustomOption,
13
- }, classNames: {
14
- control: () => "af-form__input-select",
15
- menu: () => "af-form__input-select-menu",
16
- menuList: () => "af-form__select-menu-list",
17
- container: ({ isFocused, isDisabled, selectProps: { menuIsOpen }, }) => classNames("af-form__input-select-container", isFocused && "af-form__input-select-container-focused", isDisabled && "af-form__input-select-container-disabled", errorLabel &&
18
- !isFocused &&
19
- !menuIsOpen &&
20
- "af-form__input-select-container-error"),
21
- option: ({ isSelected, isFocused, }) => classNames("af-form__input-select-menu-options", isSelected && "af-form__input-select-menu-options-selected", isFocused && "af-form__input-select-menu-options-focused"),
22
- singleValue: ({ isDisabled, }) => classNames("af-form__select-single-value", isDisabled && "af-form__select-single-value-disabled"),
23
- dropdownIndicator: () => "af-form__select-dropdown-indicator",
24
- }, className: "af-form__input-select", ...otherProps }), errorLabel && (_jsxs("div", { id: `${id}__error`, className: "af-form__select-error", "aria-live": "assertive", children: [_jsx(Svg, { src: ErrorOutline, width: 16, className: "af-form__select-error-icon" }), errorLabel] }))] }));
25
- };
5
+ import { InputError } from "../InputError";
6
+ const Select = forwardRef(({ id, required, label, errorLabel, placeholder, children, ...otherProps }, inputRef) => {
7
+ const idError = useId();
8
+ let inputId = useId();
9
+ inputId = id || inputId;
10
+ const isShowingPlaceholder = otherProps.value === "";
11
+ const classname = classNames("af-form__select-input", errorLabel && "af-form__select-input--error", isShowingPlaceholder && "af-form__select-input-placeholder");
12
+ return (_jsxs("div", { children: [label && (_jsxs("label", { htmlFor: inputId, className: "af-form__select-label", children: [label, required && _jsx("span", { "aria-hidden": "true", children: " *" })] })), _jsxs("select", { className: classname, ...otherProps, ref: inputRef, id: inputId, children: [Boolean(placeholder) && (_jsx("option", { disabled: true, value: "", children: placeholder })), children] }), errorLabel && _jsx(InputError, { id: idError, message: errorLabel })] }));
13
+ });
26
14
  Select.displayName = "Select";
27
15
  export { Select };
@@ -1,6 +1,7 @@
1
1
  import "@axa-fr/design-system-look-and-feel-css/dist/Form/Text/Text.scss";
2
2
  import { ComponentPropsWithRef, MouseEventHandler } from "react";
3
3
  type Props = ComponentPropsWithRef<"input"> & {
4
+ unit?: React.ReactNode;
4
5
  classModifier?: string;
5
6
  helper?: string;
6
7
  error?: string;
@@ -8,6 +9,8 @@ type Props = ComponentPropsWithRef<"input"> & {
8
9
  label?: string;
9
10
  buttonLabel?: string;
10
11
  onButtonClick?: MouseEventHandler<HTMLButtonElement>;
12
+ sideButtonLabel?: string;
13
+ onSideButtonClick?: MouseEventHandler<HTMLButtonElement>;
11
14
  };
12
15
  declare const Text: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
13
16
  export { Text };
@@ -7,12 +7,16 @@ import { Variants } from "../../Button/Button";
7
7
  import { Svg } from "../../Svg";
8
8
  import { getComponentClassName } from "../../utilities";
9
9
  import { InputError } from "../InputError";
10
- const Text = forwardRef(({ className, classModifier = "", label, description, helper, error, buttonLabel, onButtonClick, required, ...otherProps }, inputRef) => {
11
- const componentClassName = getComponentClassName(className, classModifier, "af-form__input-text");
10
+ const Text = forwardRef(({ unit, className, classModifier = "", label, description, helper, error, buttonLabel, onButtonClick, required, sideButtonLabel, onSideButtonClick, ...otherProps }, inputRef) => {
11
+ const componentClassName = getComponentClassName("af-form__input-text", className, classModifier +
12
+ (error || otherProps["aria-errormessage"] ? " error" : ""));
12
13
  let inputId = useId();
13
14
  inputId = otherProps.id || inputId;
15
+ const idDescription = useId();
14
16
  const idError = useId();
15
- return (_jsxs("div", { className: "af-form__input-container", children: [(label || description || buttonLabel) && (_jsxs("div", { className: "af-form__label-container", children: [_jsxs("label", { htmlFor: inputId, className: "af-form__input-label", children: [label, " ", required && _jsx("span", { children: " *" })] }), description && (_jsx("span", { className: "af-form__input-description", children: description })), buttonLabel && (_jsx(Button, { className: "af-form__input-more", variant: Variants.ghost, iconLeft: _jsx(Svg, { src: infoIcon }), onClick: onButtonClick, children: buttonLabel }))] })), _jsx("input", { id: inputId, className: componentClassName, type: "text", ref: inputRef, "aria-errormessage": idError, "aria-invalid": Boolean(error), ...otherProps }), helper && _jsx("span", { className: "af-form__input-helper", children: helper }), error && _jsx(InputError, { id: idError, message: error })] }));
17
+ const idHelp = useId();
18
+ const idLabel = useId();
19
+ return (_jsxs("div", { className: "af-form__input-container", children: [(label || description || buttonLabel) && (_jsxs("div", { className: "af-form__label-container", children: [_jsxs("div", { className: "af-form__label-header", children: [_jsxs("label", { htmlFor: inputId, id: idLabel, "aria-describedby": idDescription, className: "af-form__input-label", children: [label, " ", required && _jsx("span", { "aria-hidden": "true", children: " *" })] }), sideButtonLabel && (_jsx(Button, { className: "af-form__input-modify", variant: Variants.ghost, onClick: onSideButtonClick, children: sideButtonLabel }))] }), description && (_jsx("span", { id: idDescription, className: "af-form__input-description", children: description })), buttonLabel && (_jsx(Button, { className: "af-form__input-more", variant: Variants.ghost, iconLeft: _jsx(Svg, { src: infoIcon }), onClick: onButtonClick, children: buttonLabel }))] })), _jsxs("div", { className: "af-form__input-variant", children: [_jsx("input", { id: inputId, className: componentClassName, type: "text", ref: inputRef, "aria-labelledby": idLabel, "aria-errormessage": otherProps["aria-errormessage"] ?? idError, "aria-invalid": Boolean(error || otherProps["aria-errormessage"]), "aria-describedby": idHelp, ...otherProps }), unit] }), helper && (_jsx("span", { id: idHelp, className: "af-form__input-helper", children: helper })), !otherProps["aria-errormessage"] && error && (_jsx(InputError, { id: idError, message: error }))] }));
16
20
  });
17
21
  Text.displayName = "Text";
18
22
  export { Text };
@@ -6,11 +6,11 @@ import { Button, Svg } from "../..";
6
6
  import { Variants } from "../../Button/Button";
7
7
  import { InputError } from "../InputError";
8
8
  const TextArea = forwardRef(({ className, classModifier = "", label, description, helper, error, buttonLabel, onButtonClick, required, ...otherProps }, inputRef) => {
9
- const componentClassName = getComponentClassName(className, classModifier, "af-form__input-textarea");
9
+ const componentClassName = getComponentClassName("af-form__input-textarea", className, classModifier);
10
10
  let inputId = useId();
11
11
  inputId = otherProps.id || inputId;
12
12
  const idError = useId();
13
- return (_jsxs("div", { className: "af-form__input-container", children: [_jsxs("label", { htmlFor: inputId, className: "af-form__input-label", children: [label, " ", required && _jsx("span", { children: " *" })] }), description && (_jsx("span", { className: "af-form__input-description", children: description })), buttonLabel && (_jsx(Button, { className: "af-form__input-more", variant: Variants.ghost, iconLeft: _jsx(Svg, { src: infoIcon }), onClick: onButtonClick, children: buttonLabel })), _jsx("textarea", { id: inputId, className: componentClassName, ref: inputRef, "aria-errormessage": idError, "aria-invalid": Boolean(error), ...otherProps }), helper && _jsx("span", { className: "af-form__input-helper", children: helper }), error && _jsx(InputError, { id: idError, message: error })] }));
13
+ return (_jsxs("div", { className: "af-form__input-container", children: [label && (_jsxs("div", { className: "af-form__label-container", children: [_jsxs("label", { htmlFor: inputId, className: "af-form__input-label", children: [label, " ", required && _jsx("span", { children: " *" })] }), description && (_jsx("span", { className: "af-form__input-description", children: description })), buttonLabel && (_jsx(Button, { className: "af-form__input-more", variant: Variants.ghost, iconLeft: _jsx(Svg, { src: infoIcon }), onClick: onButtonClick, children: buttonLabel }))] })), _jsx("textarea", { id: inputId, className: componentClassName, ref: inputRef, "aria-errormessage": idError, "aria-invalid": Boolean(error), ...otherProps }), helper && _jsx("span", { className: "af-form__input-helper", children: helper }), error && _jsx(InputError, { id: idError, message: error })] }));
14
14
  });
15
15
  TextArea.displayName = "TextArea";
16
16
  export { TextArea };
@@ -49,7 +49,7 @@ export declare const eventWrapper: ({ wrapper, props }: EventWrapperProps) => {
49
49
  onFocus: (ev: BaseSyntheticEvent) => void;
50
50
  };
51
51
  type AddPropsClone = Omit<RenderChildrenProps, "children"> & {
52
- child: ReactElement;
52
+ child: ReactElement<Record<string, unknown>>;
53
53
  classModifier: string;
54
54
  name: string;
55
55
  getMessageClassModifierFn?: typeof FormClassManager.getMessageClassModifier;
@@ -101,7 +101,8 @@ export const renderedChildren = ({ children, wrapper, message, messageType, }) =
101
101
  };
102
102
  if (child.props.children) {
103
103
  const subChildren = renderedChildren({
104
- children: child.props.children,
104
+ children: child.props
105
+ .children,
105
106
  wrapper,
106
107
  message,
107
108
  messageType,
@@ -119,7 +120,7 @@ export const renderedChildren = ({ children, wrapper, message, messageType, }) =
119
120
  messageType,
120
121
  classModifier: props.classModifier,
121
122
  wrapper,
122
- child,
123
+ child: child,
123
124
  }),
124
125
  });
125
126
  });
@@ -7,7 +7,7 @@ export const IconBg = ({ children, className, classModifier, isDisabled = false,
7
7
  if (isDisabled) {
8
8
  newClassModifier += " disabled";
9
9
  }
10
- return getComponentClassName(className, newClassModifier, "af-icon-bg");
10
+ return getComponentClassName("af-icon-bg", className, newClassModifier);
11
11
  }, [classModifier, isDisabled, className]);
12
12
  return _jsx("div", { className: componentClassName, children: children });
13
13
  };
@@ -1,9 +1,9 @@
1
1
  import "@axa-fr/design-system-look-and-feel-css/dist/Layout/Header/Header.scss";
2
- import { ComponentPropsWithoutRef } from "react";
2
+ import { type ComponentPropsWithoutRef, type ReactNode } from "react";
3
3
  type HeaderProps = {
4
4
  defaultActiveLink?: number;
5
- previousLink?: JSX.Element;
6
- rightItem?: JSX.Element[];
5
+ previousLink?: ReactNode;
6
+ rightItem?: ReactNode[];
7
7
  } & ComponentPropsWithoutRef<"header">;
8
8
  export declare const Header: ({ children, defaultActiveLink, previousLink, rightItem, }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
9
9
  export {};
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import "@axa-fr/design-system-look-and-feel-css/dist/Layout/Header/Header.scss";
3
- import logo from "@axa-fr/design-system-look-and-feel-css/dist/common/assets/logo-axa.svg";
4
- import { useCallback, useState } from "react";
3
+ import logo from "@axa-fr/design-system-look-and-feel-css/logo-axa.svg";
4
+ import { useCallback, useState, } from "react";
5
5
  import { NavBar } from "./NavBar";
6
6
  import { PreviousLink } from "./PreviousLink/PreviousLink";
7
7
  export const Header = ({ children, defaultActiveLink, previousLink, rightItem, }) => {
@@ -1,8 +1,8 @@
1
- import React, { ComponentPropsWithoutRef, PropsWithChildren } from "react";
1
+ import { type ComponentPropsWithoutRef, type PropsWithChildren, type Dispatch, type SetStateAction } from "react";
2
2
  import "@axa-fr/design-system-look-and-feel-css/dist/Layout/Header/NavBar/NavBar.scss";
3
3
  type NavBarProps = {
4
4
  activeLink?: number;
5
- setActiveLink: React.Dispatch<React.SetStateAction<number | undefined>>;
5
+ setActiveLink: Dispatch<SetStateAction<number | undefined>>;
6
6
  } & ComponentPropsWithoutRef<"nav">;
7
7
  declare const NavBar: ({ activeLink, children, setActiveLink, ...otherProps }: PropsWithChildren<NavBarProps>) => import("react/jsx-runtime").JSX.Element;
8
8
  export { NavBar };
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import React, { isValidElement, useMemo, } from "react";
2
+ import { isValidElement, useMemo, Children, cloneElement, } from "react";
3
3
  import "@axa-fr/design-system-look-and-feel-css/dist/Layout/Header/NavBar/NavBar.scss";
4
4
  const NavBar = ({ activeLink, children, setActiveLink, ...otherProps }) => {
5
- const validChildren = useMemo(() => (React.Children.map(children, (child) => isValidElement(child) && child) ?? []).filter((c) => Boolean(c)), [children]);
6
- return (_jsx("nav", { role: "navigation", "aria-label": "Menu principal", ...otherProps, children: _jsx("ul", { className: "af-navbar-container", role: "menubar", children: React.Children.map(validChildren, (child, index) => (_jsx("li", { className: "af-navbar-item", role: "none", children: React.cloneElement(child, {
5
+ const validChildren = useMemo(() => (Children.map(children, (child) => isValidElement(child) && child) ?? []).filter((c) => Boolean(c)), [children]);
6
+ return (_jsx("nav", { role: "navigation", "aria-label": "Menu principal", ...otherProps, children: _jsx("ul", { className: "af-navbar-container", role: "menubar", children: Children.map(validChildren, (child, index) => (_jsx("li", { className: "af-navbar-item", role: "none", children: cloneElement(child, {
7
7
  className: `af-navbar-item__link ${index === activeLink ? "af-navbar-item__link--active" : ""}`.trim(),
8
8
  onClick: () => setActiveLink(index),
9
9
  onFocus: () => setActiveLink(index),
package/dist/Link/Link.js CHANGED
@@ -8,7 +8,7 @@ export const Link = ({ href, openInNewTab = false, leftIcon, rightIcon, children
8
8
  target: "_blank",
9
9
  rel: "noopener noreferrer",
10
10
  };
11
- const componentClassName = useMemo(() => getComponentClassName(className, `${classModifier}${!className && openInNewTab ? " openInNewTab" : ""}`, "af-link"), [classModifier, className, openInNewTab]);
11
+ const componentClassName = useMemo(() => getComponentClassName("af-link", className, `${classModifier}${!className && openInNewTab ? " openInNewTab" : ""}`), [classModifier, className, openInNewTab]);
12
12
  return (_jsxs("a", { className: componentClassName, href: href, ...newTabProps, ...props, children: [leftIcon, children, (openInNewTab || Boolean(rightIcon)) &&
13
13
  (rightIcon ?? _jsx(Svg, { src: openInNew }))] }));
14
14
  };
@@ -4,6 +4,6 @@ import { useMemo } from "react";
4
4
  import { Svg } from "../../../Svg";
5
5
  import { getComponentClassName } from "../../../utilities";
6
6
  export const ClickItem = ({ children, icon, parentClickComponent: ClickComponent = ({ children: parentClickComponentChildren, ...parentClickComponentProps }) => (_jsx("button", { type: "button", ...parentClickComponentProps, children: parentClickComponentChildren })), isDisabled = false, className, classModifier = "", actionIcon = _jsx(Svg, { src: chevron, "aria-hidden": true }), ...otherProps }) => {
7
- const componentClassName = useMemo(() => getComponentClassName(className, `${classModifier}${isDisabled ? " disabled" : ""}`, "af-click-item"), [className, classModifier, isDisabled]);
7
+ const componentClassName = useMemo(() => getComponentClassName("af-click-item", className, `${classModifier}${isDisabled ? " disabled" : ""}`), [className, classModifier, isDisabled]);
8
8
  return (_jsxs(ClickComponent, { className: componentClassName, disabled: isDisabled, "aria-disabled": isDisabled, ...otherProps, children: [_jsxs("div", { className: "af-click-item__content", children: [icon && _jsx("div", { className: "af-click-item__icon", children: icon }), _jsx("div", { className: "af-click-item__label", children: children })] }), _jsx("div", { className: "af-click-item__action", children: actionIcon })] }));
9
9
  };
@@ -1,6 +1,7 @@
1
+ import { type ReactNode } from "react";
1
2
  type ContentItemDuoProps = {
2
3
  label: string;
3
- value: string;
4
+ value: ReactNode;
4
5
  isVertical?: boolean;
5
6
  className?: string;
6
7
  classModifier?: string;
@@ -2,17 +2,17 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import checkIcon from "@material-symbols/svg-400/outlined/check.svg";
3
3
  import closeIcon from "@material-symbols/svg-400/outlined/close.svg";
4
4
  import { useMemo } from "react";
5
+ import { Button, Svg } from "../..";
5
6
  import { Variants } from "../../Button/Button";
6
7
  import { getComponentClassName } from "../../utilities";
7
- import { Button, Svg } from "../..";
8
8
  export const ContentItemDuo = ({ label, value, isVertical = false, className, classModifier, isShowingDoneIcon = false, isShowingCloseIcon = false, buttonText, onButtonClick, }) => {
9
9
  const componentClassName = useMemo(() => {
10
10
  const classModifiers = [classModifier];
11
11
  if (isVertical) {
12
12
  classModifiers.push("vertical");
13
13
  }
14
- return getComponentClassName(className, classModifiers.filter(Boolean).join(" "), "af-content-item-duo");
14
+ return getComponentClassName("af-content-item-duo", className, classModifiers.filter(Boolean).join(" "));
15
15
  }, [classModifier, className, isVertical]);
16
16
  const iconContainerModifier = useMemo(() => ` af-content-item-duo__icon--${isShowingDoneIcon ? "done" : "close"}`, [isShowingDoneIcon]);
17
- return (_jsxs("div", { className: componentClassName, children: [(isShowingDoneIcon || isShowingCloseIcon) && (_jsxs("div", { className: `af-content-item-duo__icon${iconContainerModifier}`, children: [isShowingDoneIcon && _jsx(Svg, { src: checkIcon }), isShowingCloseIcon && _jsx(Svg, { src: closeIcon })] })), _jsx("p", { className: "af-content-item-duo__label", children: label }), _jsx("p", { className: "af-content-item-duo__value", children: value }), buttonText && (_jsx("div", { className: "af-content-item-duo__button", children: _jsx(Button, { variant: Variants.ghost, onClick: onButtonClick, children: buttonText }) }))] }));
17
+ return (_jsxs("div", { className: componentClassName, children: [(isShowingDoneIcon || isShowingCloseIcon) && (_jsxs("div", { className: `af-content-item-duo__icon${iconContainerModifier}`, children: [isShowingDoneIcon && _jsx(Svg, { src: checkIcon }), isShowingCloseIcon && _jsx(Svg, { src: closeIcon })] })), _jsx("p", { className: "af-content-item-duo__label", children: label }), typeof value === "string" ? (_jsx("p", { className: "af-content-item-duo__value", children: value })) : (_jsx("div", { className: "af-content-item-duo__value", children: value })), buttonText && (_jsx("div", { className: "af-content-item-duo__button", children: _jsx(Button, { variant: Variants.ghost, onClick: onButtonClick, children: buttonText }) }))] }));
18
18
  };
@@ -8,7 +8,7 @@ export const ContentItemMono = ({ children, className, classModifier, secondaryT
8
8
  if (isDisabled) {
9
9
  classModifiers.push("disabled");
10
10
  }
11
- return getComponentClassName(className, classModifiers.filter(Boolean).join(" "), "af-content-item-mono");
11
+ return getComponentClassName("af-content-item-mono", className, classModifiers.filter(Boolean).join(" "));
12
12
  }, [classModifier, isDisabled, size, className]);
13
13
  return (_jsxs("div", { className: componentClassName, children: [hasStick && (_jsx("div", { className: "af-content-item-mono__stick", role: "presentation" })), leftElement && (_jsx("div", { className: `af-content-item-mono__left-container${isLeftElementCentered
14
14
  ? " af-content-item-mono__left-container--center"
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ import { type ModalCoreProps } from "./ModalCore";
3
+ import { type ModalCoreHeaderProps } from "./components/ModalCoreHeader";
4
+ export type ModalProps = Omit<ModalCoreProps, "onOutsideTap" | "title"> & ModalCoreHeaderProps & {
5
+ onSubmit?: (event: React.MouseEvent | React.KeyboardEvent) => void;
6
+ submitTitle?: string;
7
+ cancelTitle?: string;
8
+ submitDisabled?: boolean;
9
+ cancelDisabled?: boolean;
10
+ };
11
+ declare const Modal: React.ForwardRefExoticComponent<Omit<ModalProps, "ref"> & React.RefAttributes<HTMLDialogElement>>;
12
+ export { Modal };
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { ModalCore } from "./ModalCore";
4
+ import { ButtonClient, Variants as ButtonVariants } from "../Button/Button";
5
+ import { ModalCoreHeader, } from "./components/ModalCoreHeader";
6
+ import { ModalCoreBody } from "./components/ModalCoreBody";
7
+ import { ModalCoreFooter } from "./components/ModalCoreFooter";
8
+ const Modal = forwardRef(({ children, title, submitTitle, cancelTitle, className, onCancel, onSubmit, closeButtonAriaLabel, cancelDisabled, submitDisabled, subtitle, iconTitle, levelTitle, ...props }, ref) => (_jsxs(ModalCore, { className: className, onOutsideTap: onCancel, title: title, ref: ref, ...props, children: [_jsx(ModalCoreHeader, { title: title, subtitle: subtitle, iconTitle: iconTitle, levelTitle: levelTitle, onCancel: onCancel, closeButtonAriaLabel: closeButtonAriaLabel }), _jsx(ModalCoreBody, { children: children }), _jsxs(ModalCoreFooter, { children: [onCancel && cancelTitle && (_jsx(ButtonClient, { variant: ButtonVariants.secondary, onClick: onCancel, disabled: cancelDisabled, children: cancelTitle })), onSubmit && submitTitle && (_jsx(ButtonClient, { variant: ButtonVariants.primary, onClick: onSubmit, disabled: submitDisabled, children: submitTitle }))] })] })));
9
+ Modal.displayName = "Modal";
10
+ export { Modal };
@@ -0,0 +1,11 @@
1
+ import { type ReactNode } from "react";
2
+ import "@axa-fr/design-system-look-and-feel-css/dist/Modal/Modal.scss";
3
+ export type ModalCoreProps = React.DetailedHTMLProps<React.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement> & {
4
+ className?: string;
5
+ title: string;
6
+ onOutsideTap: (event: React.MouseEvent | React.KeyboardEvent) => void;
7
+ children: ReactNode;
8
+ ref?: React.Ref<HTMLDialogElement>;
9
+ };
10
+ declare const ModalCore: import("react").ForwardRefExoticComponent<Omit<ModalCoreProps, "ref"> & import("react").RefAttributes<HTMLDialogElement>>;
11
+ export { ModalCore };
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import "@axa-fr/design-system-look-and-feel-css/dist/Modal/Modal.scss";
4
+ const ModalCore = forwardRef(({ className, title = "", onOutsideTap, children, ...props }, ref) => (_jsx("dialog", { "aria-describedby": title, className: ["af-modal", className].filter(Boolean).join(" "), onClick: onOutsideTap, ref: ref, ...props, children: _jsx("div", { className: "af-modal__dialog", onClick: (e) => e.stopPropagation(), children: _jsx("div", { className: "af-modal__content", children: children }) }) })));
5
+ ModalCore.displayName = "ModalCore";
6
+ export { ModalCore };