@axa-fr/design-system-look-and-feel-react 1.0.5-ci.17 → 1.0.5-ci.19

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.
@@ -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();
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,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
  };
@@ -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,11 +1,11 @@
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";
2
+ import ReactSelect, { ActionMeta, GroupBase, SelectInstance, SingleValue } from "react-select";
3
+ import { ComponentPropsWithRef } from "react";
4
4
  type Option = {
5
5
  label: string;
6
6
  value: string | number;
7
7
  };
8
- type Props = Omit<ComponentPropsWithoutRef<ReactSelect>, "placeholder" | "noOptionsMessage"> & {
8
+ type Props = Omit<ComponentPropsWithRef<ReactSelect>, "placeholder" | "noOptionsMessage"> & {
9
9
  id: string;
10
10
  label: string;
11
11
  options: {
@@ -20,8 +20,5 @@ type Props = Omit<ComponentPropsWithoutRef<ReactSelect>, "placeholder" | "noOpti
20
20
  disabled?: boolean;
21
21
  required?: boolean;
22
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
- };
23
+ declare const Select: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<SelectInstance<unknown, boolean, GroupBase<unknown>>>>;
27
24
  export { Select };
@@ -1,13 +1,17 @@
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/Form/Select/Select.scss";
3
- import ErrorOutline from "@material-symbols/svg-400/outlined/error.svg";
4
3
  import ReactSelect from "react-select";
4
+ import { forwardRef, useId } from "react";
5
5
  import classNames from "classnames";
6
6
  import { DropdownIndicator } from "./DropdownIndicator";
7
- import { Svg } from "../../Svg";
8
7
  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: {
8
+ import { defaultAriaLiveMessages } from "./arialiveMessagesDefault";
9
+ import { InputError } from "../InputError";
10
+ const Select = forwardRef(({ id, required, disabled, label, errorLabel, noOptionsMessage, ...otherProps }, inputRef) => {
11
+ const idError = useId();
12
+ let inputId = useId();
13
+ inputId = id || inputId;
14
+ return (_jsxs(_Fragment, { children: [label && (_jsxs("label", { htmlFor: inputId, className: "af-form__select-label", children: [label, required && _jsx("span", { "aria-hidden": "true", children: " *" })] })), _jsx(ReactSelect, { id: inputId, "aria-errormessage": idError, "aria-invalid": Boolean(errorLabel), ariaLiveMessages: defaultAriaLiveMessages, screenReaderStatus: ({ count }) => `${count} résultat${count > 1 ? "s" : ""} disponible${count > 1 ? "s" : ""}`, unstyled: true, isDisabled: disabled, noOptionsMessage: () => noOptionsMessage || "Aucun résultat", components: {
11
15
  DropdownIndicator,
12
16
  Option: CustomOption,
13
17
  }, classNames: {
@@ -21,7 +25,7 @@ const Select = ({ id, required, disabled, label, errorLabel, noOptionsMessage, .
21
25
  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
26
  singleValue: ({ isDisabled, }) => classNames("af-form__select-single-value", isDisabled && "af-form__select-single-value-disabled"),
23
27
  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
- };
28
+ }, className: "af-form__input-select", ...otherProps, ref: inputRef }), errorLabel && _jsx(InputError, { id: idError, message: errorLabel })] }));
29
+ });
26
30
  Select.displayName = "Select";
27
31
  export { Select };
@@ -0,0 +1,7 @@
1
+ import { AriaGuidanceProps, AriaOnChangeProps, AriaOnFilterProps, AriaOnFocusProps, GroupBase } from "react-select";
2
+ export declare const defaultAriaLiveMessages: {
3
+ guidance: (props: AriaGuidanceProps) => string;
4
+ onChange: <Option, IsMulti extends boolean>(props: AriaOnChangeProps<Option, IsMulti>) => string;
5
+ onFocus: <Option, Group extends GroupBase<Option>>(props: AriaOnFocusProps<Option, Group>) => string;
6
+ onFilter: (props: AriaOnFilterProps) => string;
7
+ };
@@ -0,0 +1,53 @@
1
+ export const defaultAriaLiveMessages = {
2
+ guidance: (props) => {
3
+ const { isSearchable, isMulti, tabSelectsValue, context, isInitialFocus } = props;
4
+ switch (context) {
5
+ case "menu":
6
+ return `Utilisez les flèches Haut et Bas pour choisir des options, appuyez sur Entrée pour sélectionner l'option actuellement mise au point, appuyez sur Échap pour quitter le menu${tabSelectsValue ? ", appuyez sur Tab pour sélectionner l'option et quitter le menu" : ""}.`;
7
+ case "input":
8
+ return isInitialFocus
9
+ ? `${props["aria-label"] || "Sélectionner"} est sélectionné ${isSearchable ? ", tapez du texte pour affiner la liste" : ""}, appuyez sur Bas pour ouvrir le menu, ${isMulti ? " appuyez sur Gauche pour mettre au point les valeurs sélectionnées" : ""}`
10
+ : "";
11
+ case "value":
12
+ return "Utilisez les flèches Gauche et Droite pour basculer entre les valeurs sélectionnées, appuyez sur Retour arrière pour supprimer la valeur actuellement sélectionnée.";
13
+ default:
14
+ return "";
15
+ }
16
+ },
17
+ onChange: (props) => {
18
+ const { action, label = "", labels, isDisabled } = props;
19
+ switch (action) {
20
+ case "deselect-option":
21
+ case "pop-value":
22
+ case "remove-value":
23
+ return `option ${label}, désélectionnée.`;
24
+ case "clear":
25
+ return "Toutes les options sélectionnées ont été effacées.";
26
+ case "initial-input-focus":
27
+ return `${labels.length > 1 ? "les " : "l'"}option${labels.length > 1 ? "s" : ""} ${labels.join(",")} ${labels.length > 1 ? "sont" : "est"} sélectionnée${labels.length > 1 ? "s" : ""}.`;
28
+ case "select-option":
29
+ return isDisabled
30
+ ? `l'option ${label} est désactivée. Sélectionnez une autre option.`
31
+ : `l'option ${label} est sélectionnée.`;
32
+ default:
33
+ return "";
34
+ }
35
+ },
36
+ onFocus: (props) => {
37
+ const { context, focused, options, label = "", selectValue, isDisabled, isSelected, isAppleDevice, } = props;
38
+ const getArrayIndex = (arr, item) => arr && arr.length ? `${arr.indexOf(item) + 1} sur ${arr.length}` : "";
39
+ if (context === "value" && selectValue) {
40
+ return `la valeur ${label} est sélectionnée, ${getArrayIndex(selectValue, focused)}.`;
41
+ }
42
+ if (context === "menu" && isAppleDevice) {
43
+ const disabled = isDisabled ? " désactivé" : "";
44
+ const status = `${isSelected ? " sélectionné" : ""}${disabled}`;
45
+ return `${label}${status}, ${getArrayIndex(options, focused)}.`;
46
+ }
47
+ return "";
48
+ },
49
+ onFilter: (props) => {
50
+ const { inputValue, resultsMessage } = props;
51
+ return `${resultsMessage}${inputValue ? ` pour le terme de recherche : ${inputValue}` : ""}.`;
52
+ },
53
+ };
@@ -8,7 +8,7 @@ import { Svg } from "../../Svg";
8
8
  import { getComponentClassName } from "../../utilities";
9
9
  import { InputError } from "../InputError";
10
10
  const Text = forwardRef(({ unit, className, classModifier = "", label, description, helper, error, buttonLabel, onButtonClick, required, ...otherProps }, inputRef) => {
11
- const componentClassName = getComponentClassName(className, classModifier, "af-form__input-text");
11
+ const componentClassName = getComponentClassName("af-form__input-text", className, classModifier);
12
12
  let inputId = useId();
13
13
  inputId = otherProps.id || inputId;
14
14
  const idDescription = useId();
@@ -6,7 +6,7 @@ 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();
@@ -1,7 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import home from "@material-symbols/svg-400/outlined/home.svg";
2
3
  import { MyFooter } from "./components/MyFooter";
3
4
  import { MyHeader } from "./components/MyHeader";
4
- import { Button, ButtonVariants, TextInput, Title } from "..";
5
+ import { Button, ButtonVariants, CheckboxSelect, RadioSelect, Svg, TextInput, Title, } from "..";
5
6
  import { DebugGrid } from "./DebugGrid";
6
7
  function capitalizeFirstLetter(val) {
7
8
  return String(val).charAt(0).toUpperCase() + String(val).slice(1);
@@ -17,7 +18,7 @@ const setAttributesFields = (value, label, type = "text") => ({
17
18
  placeholder: `Votre ${label}`,
18
19
  description: `Saisissez un ${label}`,
19
20
  error: `Un ${label} est obligatoire`,
20
- className: "subgrid af-form__input-text",
21
+ className: "subgrid",
21
22
  helper: "Do you need help ?",
22
23
  buttonLabel: "En savoir plus",
23
24
  });
@@ -27,4 +28,46 @@ const FIELDS = [
27
28
  setAttributesFields("samuel.gomez@axa.fr", "email", "email"),
28
29
  setAttributesFields("0601020304", "téléphone"),
29
30
  ];
30
- export const render = () => (_jsxs(_Fragment, { children: [_jsx(DebugGrid, { isCheckedByDefault: true }), _jsx(MyHeader, {}), _jsx("main", { className: "grid example-form", children: _jsxs("form", { className: "form", children: [_jsxs("div", { className: "form__header subgrid", children: [_jsx(Title, { children: "Mon formulaire" }), _jsx("p", { children: "Les mentions avec * sont obligatoires" })] }), _jsx("div", { className: "form__fields subgrid", children: FIELDS.map((field) => (_jsx(TextInput, { ...field, classModifier: field.error ? "error" : "" }, field.id))) }), _jsxs("div", { className: "form__actions subgrid", children: [_jsx(Button, { variant: ButtonVariants.secondary, children: "Pr\u00E9c\u00E9dent" }), _jsx(Button, { variant: ButtonVariants.primary, children: "Valider" })] })] }) }), _jsx(MyFooter, {})] }));
31
+ export const render = () => (_jsxs(_Fragment, { children: [_jsx(DebugGrid, { isCheckedByDefault: true }), _jsx(MyHeader, {}), _jsx("main", { className: "grid example-form", children: _jsxs("form", { className: "form", children: [_jsxs("div", { className: "form__header subgrid", children: [_jsx(Title, { children: "Mon formulaire" }), _jsx("p", { children: "Les mentions avec * sont obligatoires" })] }), _jsxs("div", { className: "form__fields subgrid", children: [_jsx(RadioSelect, { className: "subgrid", label: "Genre", type: "horizontal", options: [
32
+ { label: "Homme", value: "H", icon: _jsx(Svg, { src: home }) },
33
+ { label: "Femme", value: "F", icon: _jsx(Svg, { src: home }) },
34
+ { label: "Les deux", value: "HF", icon: _jsx(Svg, { src: home }) },
35
+ {
36
+ label: "Ne se prononce pas",
37
+ value: "N",
38
+ icon: _jsx(Svg, { src: home }),
39
+ },
40
+ ], name: "radio-name" }), _jsx(CheckboxSelect, { className: "subgrid", type: "horizontal", labelGroup: "Titre", options: [
41
+ {
42
+ label: "Développeur",
43
+ value: "H",
44
+ name: "Développeur",
45
+ icon: _jsx(Svg, { src: home }),
46
+ },
47
+ { label: "BA", value: "F", name: "BA", icon: _jsx(Svg, { src: home }) },
48
+ {
49
+ label: "EM",
50
+ value: "HF",
51
+ name: "EM",
52
+ icon: _jsx(Svg, { src: home }),
53
+ },
54
+ { label: "PO", value: "A", name: "PO", icon: _jsx(Svg, { src: home }) },
55
+ {
56
+ label: "DBA",
57
+ value: "Au",
58
+ name: "DBA",
59
+ icon: _jsx(Svg, { src: home }),
60
+ },
61
+ {
62
+ label: "Scrum Master",
63
+ value: "P",
64
+ name: "Scrum Master",
65
+ icon: _jsx(Svg, { src: home }),
66
+ },
67
+ {
68
+ label: "Ne se prononce pas",
69
+ value: "N",
70
+ name: "Ne se prononce pas",
71
+ icon: _jsx(Svg, { src: home }),
72
+ },
73
+ ] }), FIELDS.map((field) => (_jsx(TextInput, { ...field, classModifier: field.error ? "error" : "" }, field.id)))] }), _jsxs("div", { className: "form__actions subgrid", children: [_jsx(Button, { variant: ButtonVariants.secondary, children: "Pr\u00E9c\u00E9dent" }), _jsx(Button, { variant: ButtonVariants.primary, children: "Valider" })] })] }) }), _jsx(MyFooter, {})] }));
@@ -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
  };
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
  };
@@ -11,7 +11,7 @@ export const ContentItemDuo = ({ label, value, isVertical = false, className, cl
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
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 }) }))] }));
@@ -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"
package/dist/Tag/Tag.js CHANGED
@@ -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 Tag = ({ children, className, classModifier = "", ...divProps }) => {
5
- const componentClassName = useMemo(() => getComponentClassName(className, classModifier, "af-tag"), [className, classModifier]);
5
+ const componentClassName = useMemo(() => getComponentClassName("af-tag", className, classModifier), [className, classModifier]);
6
6
  return (_jsx("div", { className: componentClassName, ...divProps, children: _jsx("span", { className: "af-tag__label", children: children }) }));
7
7
  };
@@ -5,7 +5,7 @@ import { getComponentClassName } from "../utilities";
5
5
  import { TitleSize } from "./constants";
6
6
  import { TitleWithSubtitles } from "./TitleWithSubtitles";
7
7
  export const Title = ({ children: title, className, classModifier, firstSubtitle, icon, secondSubtitle, size = TitleSize.XL, level = size === TitleSize.L ? 2 : 1, }) => {
8
- const componentClassName = useMemo(() => getComponentClassName(className, classModifier ? `${classModifier} ${size}` : size, "af-title"), [classModifier, className, size]);
8
+ const componentClassName = useMemo(() => getComponentClassName("af-title", className, classModifier ? `${classModifier} ${size}` : size), [classModifier, className, size]);
9
9
  const TitleWithSubtitlesPart = useCallback(({ ...args }) => (_jsx(TitleWithSubtitles, { title: title, firstSubtitle: firstSubtitle, level: level, ...args })), [title, firstSubtitle, level]);
10
10
  return (_jsx("header", { className: componentClassName, children: icon && size === TitleSize.XL ? (_jsxs(_Fragment, { children: [_jsx(IconBg, { className: "af-title__icon af-icon-bg", children: icon }), _jsx(TitleWithSubtitlesPart, { secondSubtitle: secondSubtitle })] })) : (_jsx(TitleWithSubtitlesPart, {})) }));
11
11
  };
@@ -1 +1 @@
1
- export declare const getComponentClassName: (className?: string, classModifier?: string, defaultClassName?: string) => string;
1
+ export declare const getComponentClassName: (defaultClassName: string, className?: string, classModifier?: string) => string;
@@ -1,9 +1,9 @@
1
1
  import classNames from "classnames";
2
- const getLastClassName = (classNameToUse) => {
3
- if (!classNameToUse) {
2
+ const getLastClassName = (defaultClassName) => {
3
+ if (!defaultClassName) {
4
4
  return null;
5
5
  }
6
- return classNameToUse.split(" ").filter(Boolean).at(-1);
6
+ return defaultClassName.split(" ").filter(Boolean).at(-1);
7
7
  };
8
8
  const listClassModifier = (classModifier) => {
9
9
  if (!classModifier) {
@@ -11,17 +11,16 @@ const listClassModifier = (classModifier) => {
11
11
  }
12
12
  return classModifier.split(" ");
13
13
  };
14
- export const getComponentClassName = (className, classModifier, defaultClassName) => {
15
- const classNameToUse = className || defaultClassName;
16
- if (!classNameToUse) {
14
+ export const getComponentClassName = (defaultClassName, className, classModifier) => {
15
+ if (!defaultClassName) {
17
16
  return "";
18
17
  }
19
- const classWithoutModifier = getLastClassName(classNameToUse);
18
+ const classWithoutModifier = getLastClassName(defaultClassName);
20
19
  const modifiers = listClassModifier(classModifier);
21
20
  const modifiersObject = modifiers
22
21
  .filter((it) => /\S/.test(it))
23
22
  .map((it) => {
24
23
  return `${classWithoutModifier}--${it}`;
25
24
  });
26
- return classNames(classNameToUse, modifiersObject);
25
+ return classNames(defaultClassName, className, modifiersObject);
27
26
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/design-system-look-and-feel-react",
3
- "version": "1.0.5-ci.17",
3
+ "version": "1.0.5-ci.19",
4
4
  "description": "",
5
5
  "exports": {
6
6
  ".": {
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "homepage": "https://github.com/AxaFrance/design-system#readme",
47
47
  "peerDependencies": {
48
- "@axa-fr/design-system-look-and-feel-css": "1.0.5-ci.17",
48
+ "@axa-fr/design-system-look-and-feel-css": "1.0.5-ci.19",
49
49
  "@material-symbols/svg-400": ">= 0.19.0",
50
50
  "react": ">= 18"
51
51
  },