@axa-fr/design-system-look-and-feel-react 1.0.5-ci.18 → 1.0.5-ci.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AccordionCore/AccordionCore.js +1 -1
- package/dist/Card/Card.js +1 -1
- package/dist/Divider/Divider.js +1 -1
- package/dist/Form/Checkbox/CheckboxSelect.d.ts +3 -3
- package/dist/Form/Checkbox/CheckboxSelect.js +5 -2
- package/dist/Form/Radio/RadioSelect.d.ts +1 -1
- package/dist/Form/Radio/RadioSelect.js +5 -2
- package/dist/Form/Select/Select.js +1 -1
- package/dist/Form/Text/Text.js +1 -1
- package/dist/Form/TextArea/TextArea.js +1 -1
- package/dist/Grid/renderExampleForm.js +46 -3
- package/dist/IconBg/IconBg.js +1 -1
- package/dist/Link/Link.js +1 -1
- package/dist/List/ClickList/ClickItem/ClickItem.js +1 -1
- package/dist/List/ContentItemDuo/ContentItemDuo.js +1 -1
- package/dist/List/ContentItemMono/ContentItemMono.js +1 -1
- package/dist/Tag/Tag.js +1 -1
- package/dist/Title/Title.js +1 -1
- package/dist/utilities/helpers/getComponentClassName.d.ts +1 -1
- package/dist/utilities/helpers/getComponentClassName.js +7 -8
- package/package.json +2 -2
@@ -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(
|
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(
|
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
|
};
|
package/dist/Divider/Divider.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 Divider = ({ className, classModifier }) => {
|
5
|
-
const componentClassName = useMemo(() => getComponentClassName(
|
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
|
-
|
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:
|
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
|
-
|
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:
|
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";
|
@@ -11,7 +11,7 @@ const Select = forwardRef(({ id, required, disabled, label, errorLabel, noOption
|
|
11
11
|
const idError = useId();
|
12
12
|
let inputId = useId();
|
13
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, {
|
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, { inputId: 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: {
|
15
15
|
DropdownIndicator,
|
16
16
|
Option: CustomOption,
|
17
17
|
}, classNames: {
|
package/dist/Form/Text/Text.js
CHANGED
@@ -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(
|
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(
|
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
|
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" })] }),
|
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, {})] }));
|
package/dist/IconBg/IconBg.js
CHANGED
@@ -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(
|
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" : ""}
|
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" : ""}
|
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(" ")
|
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(" ")
|
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(
|
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
|
};
|
package/dist/Title/Title.js
CHANGED
@@ -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
|
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: (
|
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 = (
|
3
|
-
if (!
|
2
|
+
const getLastClassName = (defaultClassName) => {
|
3
|
+
if (!defaultClassName) {
|
4
4
|
return null;
|
5
5
|
}
|
6
|
-
return
|
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
|
15
|
-
|
16
|
-
if (!classNameToUse) {
|
14
|
+
export const getComponentClassName = (defaultClassName, className, classModifier) => {
|
15
|
+
if (!defaultClassName) {
|
17
16
|
return "";
|
18
17
|
}
|
19
|
-
const classWithoutModifier = getLastClassName(
|
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(
|
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.
|
3
|
+
"version": "1.0.5-ci.20",
|
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.
|
48
|
+
"@axa-fr/design-system-look-and-feel-css": "1.0.5-ci.20",
|
49
49
|
"@material-symbols/svg-400": ">= 0.19.0",
|
50
50
|
"react": ">= 18"
|
51
51
|
},
|