@axa-fr/design-system-look-and-feel-react 0.1.1
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/Accordion/Accordion.d.ts +12 -0
- package/dist/Accordion/Accordion.js +11 -0
- package/dist/Accordion/AccordionTagDateContainer.d.ts +10 -0
- package/dist/Accordion/AccordionTagDateContainer.js +10 -0
- package/dist/Accordion/index.d.ts +3 -0
- package/dist/Accordion/index.js +3 -0
- package/dist/AccordionCore/AccordionCore.d.ts +12 -0
- package/dist/AccordionCore/AccordionCore.js +13 -0
- package/dist/AccordionCore/index.d.ts +2 -0
- package/dist/AccordionCore/index.js +2 -0
- package/dist/Alert/Alert.d.ts +22 -0
- package/dist/Alert/Alert.js +27 -0
- package/dist/Button/Button.d.ts +17 -0
- package/dist/Button/Button.js +15 -0
- package/dist/Card/Card.d.ts +6 -0
- package/dist/Card/Card.js +9 -0
- package/dist/Card/index.d.ts +2 -0
- package/dist/Card/index.js +2 -0
- package/dist/Form/Checkbox/Checkbox.d.ts +7 -0
- package/dist/Form/Checkbox/Checkbox.js +15 -0
- package/dist/Form/Checkbox/CheckboxSelect.d.ts +15 -0
- package/dist/Form/Checkbox/CheckboxSelect.js +7 -0
- package/dist/Form/Checkbox/index.d.ts +2 -0
- package/dist/Form/Checkbox/index.js +2 -0
- package/dist/Form/FileUpload/FileUpload.d.ts +32 -0
- package/dist/Form/FileUpload/FileUpload.js +51 -0
- package/dist/Form/FileUpload/index.d.ts +1 -0
- package/dist/Form/FileUpload/index.js +1 -0
- package/dist/Form/InputError/InputError.d.ts +7 -0
- package/dist/Form/InputError/InputError.js +5 -0
- package/dist/Form/InputError/index.d.ts +1 -0
- package/dist/Form/InputError/index.js +1 -0
- package/dist/Form/Radio/Radio.d.ts +7 -0
- package/dist/Form/Radio/Radio.js +14 -0
- package/dist/Form/Radio/RadioSelect.d.ts +20 -0
- package/dist/Form/Radio/RadioSelect.js +16 -0
- package/dist/Form/Radio/index.d.ts +2 -0
- package/dist/Form/Radio/index.js +2 -0
- package/dist/Form/Select/CustomOption.d.ts +4 -0
- package/dist/Form/Select/CustomOption.js +8 -0
- package/dist/Form/Select/DropdownIndicator.d.ts +4 -0
- package/dist/Form/Select/DropdownIndicator.js +11 -0
- package/dist/Form/Select/Select.d.ts +27 -0
- package/dist/Form/Select/Select.js +27 -0
- package/dist/Form/Select/index.d.ts +1 -0
- package/dist/Form/Select/index.js +1 -0
- package/dist/Form/Text/Text.d.ts +13 -0
- package/dist/Form/Text/Text.js +16 -0
- package/dist/Form/Text/index.d.ts +1 -0
- package/dist/Form/Text/index.js +1 -0
- package/dist/Form/core/Field.d.ts +16 -0
- package/dist/Form/core/Field.js +12 -0
- package/dist/Form/core/FieldError.d.ts +7 -0
- package/dist/Form/core/FieldError.js +8 -0
- package/dist/Form/core/FieldForm.d.ts +59 -0
- package/dist/Form/core/FieldForm.js +151 -0
- package/dist/Form/core/FieldInput.d.ts +9 -0
- package/dist/Form/core/FieldInput.js +9 -0
- package/dist/Form/core/FormClassManager.d.ts +7 -0
- package/dist/Form/core/FormClassManager.js +33 -0
- package/dist/Form/core/HelpMessage.d.ts +7 -0
- package/dist/Form/core/HelpMessage.js +2 -0
- package/dist/Form/core/InputList.d.ts +8 -0
- package/dist/Form/core/InputList.js +4 -0
- package/dist/Form/core/MessageTypes.d.ts +5 -0
- package/dist/Form/core/MessageTypes.js +6 -0
- package/dist/Form/core/getComponentClassName.d.ts +1 -0
- package/dist/Form/core/getComponentClassName.js +27 -0
- package/dist/Form/core/getFirstId.d.ts +2 -0
- package/dist/Form/core/getFirstId.js +1 -0
- package/dist/Form/core/getOptionClassName.d.ts +1 -0
- package/dist/Form/core/getOptionClassName.js +10 -0
- package/dist/Form/core/index.d.ts +31 -0
- package/dist/Form/core/index.js +13 -0
- package/dist/Form/core/useInputClassModifier.d.ts +4 -0
- package/dist/Form/core/useInputClassModifier.js +12 -0
- package/dist/Form/core/useOptionsWithId.d.ts +2 -0
- package/dist/Form/core/useOptionsWithId.js +13 -0
- package/dist/IconBg/IconBg.d.ts +9 -0
- package/dist/IconBg/IconBg.js +13 -0
- package/dist/IconBg/index.d.ts +2 -0
- package/dist/IconBg/index.js +2 -0
- package/dist/Layout/Footer/DynamicIcons.d.ts +4 -0
- package/dist/Layout/Footer/DynamicIcons.js +20 -0
- package/dist/Layout/Footer/Footer.d.ts +14 -0
- package/dist/Layout/Footer/Footer.js +16 -0
- package/dist/Layout/Footer/MenuIcons.d.ts +9 -0
- package/dist/Layout/Footer/MenuIcons.js +8 -0
- package/dist/Layout/Footer/MenuLink.d.ts +11 -0
- package/dist/Layout/Footer/MenuLink.js +10 -0
- package/dist/Layout/Header/Header.d.ts +9 -0
- package/dist/Layout/Header/Header.js +11 -0
- package/dist/Layout/Header/NavBar/NavBar.d.ts +8 -0
- package/dist/Layout/Header/NavBar/NavBar.js +13 -0
- package/dist/Layout/Header/NavBar/index.d.ts +1 -0
- package/dist/Layout/Header/NavBar/index.js +1 -0
- package/dist/Layout/Header/PreviousLink/PreviousLink.d.ts +7 -0
- package/dist/Layout/Header/PreviousLink/PreviousLink.js +14 -0
- package/dist/Layout/Header/PreviousLink/index.d.ts +1 -0
- package/dist/Layout/Header/PreviousLink/index.js +1 -0
- package/dist/Layout/Header/index.d.ts +1 -0
- package/dist/Layout/Header/index.js +1 -0
- package/dist/Link/Link.d.ts +7 -0
- package/dist/Link/Link.js +11 -0
- package/dist/List/ClickList/ClickItem/ClickItem.d.ts +11 -0
- package/dist/List/ClickList/ClickItem/ClickItem.js +17 -0
- package/dist/List/ClickList/ClickItem/index.d.ts +1 -0
- package/dist/List/ClickList/ClickItem/index.js +1 -0
- package/dist/List/ClickList/ClickList.d.ts +8 -0
- package/dist/List/ClickList/ClickList.js +4 -0
- package/dist/List/ClickList/index.d.ts +3 -0
- package/dist/List/ClickList/index.js +3 -0
- package/dist/List/ContentItemDuo/ContentItemDuo.d.ts +13 -0
- package/dist/List/ContentItemDuo/ContentItemDuo.js +18 -0
- package/dist/List/ContentItemDuo/index.d.ts +2 -0
- package/dist/List/ContentItemDuo/index.js +2 -0
- package/dist/List/ContentItemMono/ContentItemMono.d.ts +16 -0
- package/dist/List/ContentItemMono/ContentItemMono.js +16 -0
- package/dist/List/ContentItemMono/constants.d.ts +4 -0
- package/dist/List/ContentItemMono/constants.js +5 -0
- package/dist/List/ContentItemMono/index.d.ts +3 -0
- package/dist/List/ContentItemMono/index.js +3 -0
- package/dist/List/ContentTabList/ContentTabItem/ContentTabItem.d.ts +6 -0
- package/dist/List/ContentTabList/ContentTabItem/ContentTabItem.js +6 -0
- package/dist/List/ContentTabList/ContentTabItem/index.d.ts +2 -0
- package/dist/List/ContentTabList/ContentTabItem/index.js +1 -0
- package/dist/List/ContentTabList/ContentTabList.d.ts +8 -0
- package/dist/List/ContentTabList/ContentTabList.js +9 -0
- package/dist/List/ContentTabList/index.d.ts +1 -0
- package/dist/List/ContentTabList/index.js +1 -0
- package/dist/List/List.d.ts +6 -0
- package/dist/List/List.js +9 -0
- package/dist/List/index.d.ts +1 -0
- package/dist/List/index.js +1 -0
- package/dist/Loader/Loader.d.ts +11 -0
- package/dist/Loader/Loader.js +10 -0
- package/dist/Loader/index.d.ts +1 -0
- package/dist/Loader/index.js +1 -0
- package/dist/ModalClient/Modal.d.ts +24 -0
- package/dist/ModalClient/Modal.js +53 -0
- package/dist/Pagination/Pagination.d.ts +9 -0
- package/dist/Pagination/Pagination.js +14 -0
- package/dist/Pagination/PaginationDesktop.d.ts +9 -0
- package/dist/Pagination/PaginationDesktop.js +31 -0
- package/dist/Pagination/PaginationMobile.d.ts +9 -0
- package/dist/Pagination/PaginationMobile.js +10 -0
- package/dist/Stepper/Stepper.d.ts +12 -0
- package/dist/Stepper/Stepper.js +22 -0
- package/dist/Svg/Svg.d.ts +7 -0
- package/dist/Svg/Svg.js +47 -0
- package/dist/Svg/index.d.ts +1 -0
- package/dist/Svg/index.js +1 -0
- package/dist/Svg/svgInjector.d.ts +12 -0
- package/dist/Svg/svgInjector.js +28 -0
- package/dist/Tabs/Tabs.d.ts +16 -0
- package/dist/Tabs/Tabs.js +48 -0
- package/dist/Tag/Tag.d.ts +6 -0
- package/dist/Tag/Tag.js +7 -0
- package/dist/Tag/index.d.ts +2 -0
- package/dist/Tag/index.js +2 -0
- package/dist/Title/Title.d.ts +14 -0
- package/dist/Title/Title.js +11 -0
- package/dist/Title/TitleWithSubtitles.d.ts +10 -0
- package/dist/Title/TitleWithSubtitles.js +6 -0
- package/dist/Title/constants.d.ts +5 -0
- package/dist/Title/constants.js +5 -0
- package/dist/Title/index.d.ts +3 -0
- package/dist/Title/index.js +3 -0
- package/dist/assets/svg/facebook.svg +1 -0
- package/dist/assets/svg/linkedin.svg +1 -0
- package/dist/assets/svg/twitterx.svg +1 -0
- package/dist/assets/svg/youtube.svg +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +28 -0
- package/dist/utilities/constants.d.ts +6 -0
- package/dist/utilities/constants.js +7 -0
- package/dist/utilities/helpers/getComponentClassName.d.ts +1 -0
- package/dist/utilities/helpers/getComponentClassName.js +27 -0
- package/dist/utilities/hooks/useIsSmallScreen.d.ts +1 -0
- package/dist/utilities/hooks/useIsSmallScreen.js +14 -0
- package/dist/utilities.d.ts +3 -0
- package/dist/utilities.js +3 -0
- package/package.json +123 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useCallback, useId } from "react";
|
3
|
+
import classNames from "classnames";
|
4
|
+
import "@axa-fr/design-system-look-and-feel-css/dist/Stepper/Stepper.scss";
|
5
|
+
const INITIAL_STEPPER_PROGRESS = 10;
|
6
|
+
const MAX_STEPPER_PROGRESS = 100;
|
7
|
+
export const Stepper = ({ currentStepProgress = INITIAL_STEPPER_PROGRESS, currentTitle, nbSteps, currentStep, currentSubtitle, isTitleVisible = true, isSubtitleVisible = true, className, ...props }) => {
|
8
|
+
const stepperId = useId();
|
9
|
+
const getCurrentProgress = useCallback((index) => {
|
10
|
+
if (index < currentStep) {
|
11
|
+
return MAX_STEPPER_PROGRESS;
|
12
|
+
}
|
13
|
+
if (index === currentStep) {
|
14
|
+
if (currentStepProgress === 0) {
|
15
|
+
return INITIAL_STEPPER_PROGRESS;
|
16
|
+
}
|
17
|
+
return currentStepProgress;
|
18
|
+
}
|
19
|
+
return 0;
|
20
|
+
}, [currentStep, currentStepProgress]);
|
21
|
+
return (_jsxs("div", { className: "af-stepper-client", ...props, children: [isTitleVisible && currentTitle && (_jsx("h2", { className: "af-stepper-client__title", "aria-describedby": stepperId, children: currentTitle })), isSubtitleVisible && currentSubtitle && (_jsx("p", { className: "af-stepper-client__subtitle", children: currentSubtitle })), _jsx("div", { id: stepperId, role: "group", "aria-label": currentTitle, className: classNames("af-stepper-client__content", className), children: [...Array(nbSteps).keys()].map((index) => (_jsx("div", { className: "af-stepper-client__progressbar", "aria-current": index === currentStep, "aria-hidden": index !== currentStep, "aria-label": `${getCurrentProgress(index)}%`, children: _jsx("div", { className: "af-stepper-client__progress", style: { width: `${getCurrentProgress(index)}%` } }) }, `${stepperId}-${index}`))) })] }));
|
22
|
+
};
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { type SVGAttributes } from "react";
|
2
|
+
type SvgProps = SVGAttributes<SVGSVGElement> & {
|
3
|
+
src: string;
|
4
|
+
alt?: string;
|
5
|
+
};
|
6
|
+
export declare const Svg: ({ src, alt, width, height, ...props }: SvgProps) => import("react/jsx-runtime").JSX.Element | null;
|
7
|
+
export {};
|
package/dist/Svg/Svg.js
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { useLayoutEffect, useRef, useState, } from "react";
|
3
|
+
import { svgInjector } from "./svgInjector";
|
4
|
+
const cloneAttributes = (from, to) => {
|
5
|
+
const attributes = from.getAttributeNames();
|
6
|
+
attributes.forEach((attribute) => {
|
7
|
+
to.setAttribute(attribute, from.getAttribute(attribute));
|
8
|
+
});
|
9
|
+
};
|
10
|
+
export const Svg = ({ src, alt, width = 24, height = 24, ...props }) => {
|
11
|
+
const rootRef = useRef(null);
|
12
|
+
const [hasError, setHasError] = useState(false);
|
13
|
+
useLayoutEffect(() => {
|
14
|
+
if (hasError) {
|
15
|
+
setHasError(false);
|
16
|
+
}
|
17
|
+
}, [src]);
|
18
|
+
useLayoutEffect(() => {
|
19
|
+
if (hasError) {
|
20
|
+
return;
|
21
|
+
}
|
22
|
+
const root = rootRef.current;
|
23
|
+
if (root) {
|
24
|
+
const parent = document.createElement("div");
|
25
|
+
const svg = document.createElement("svg");
|
26
|
+
parent.appendChild(svg);
|
27
|
+
cloneAttributes(root, svg);
|
28
|
+
svg.setAttribute("width", width.toString());
|
29
|
+
svg.setAttribute("height", height.toString());
|
30
|
+
svgInjector(svg, {
|
31
|
+
afterEach: (error, svgInject) => {
|
32
|
+
if (error) {
|
33
|
+
setHasError(true);
|
34
|
+
}
|
35
|
+
if (svgInject) {
|
36
|
+
root.innerHTML = svgInject.innerHTML;
|
37
|
+
cloneAttributes(svgInject, root);
|
38
|
+
}
|
39
|
+
},
|
40
|
+
});
|
41
|
+
}
|
42
|
+
}, [src, width, height, hasError]);
|
43
|
+
if (hasError) {
|
44
|
+
return alt ? (_jsx("span", { ...props, children: alt })) : null;
|
45
|
+
}
|
46
|
+
return _jsx("svg", { ref: rootRef, "data-src": src, ...props });
|
47
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export { Svg } from "./Svg";
|
@@ -0,0 +1 @@
|
|
1
|
+
export { Svg } from "./Svg";
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { type AfterAll, type BeforeEach, type Errback, type EvalScripts } from "@tanem/svg-injector";
|
2
|
+
type Options = {
|
3
|
+
afterAll?: AfterAll;
|
4
|
+
afterEach?: Errback;
|
5
|
+
beforeEach?: BeforeEach;
|
6
|
+
cacheRequests?: boolean;
|
7
|
+
evalScripts?: EvalScripts;
|
8
|
+
httpRequestWithCredentials?: boolean;
|
9
|
+
renumerateIRIElements?: boolean;
|
10
|
+
};
|
11
|
+
export declare const svgInjector: (element: HTMLElement | SVGSVGElement | null, { beforeEach, ...options }?: Options) => void;
|
12
|
+
export {};
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { SVGInjector, } from "@tanem/svg-injector";
|
2
|
+
import DOMPurify from "dompurify";
|
3
|
+
const attributesToRestore = ["fill", "stroke"];
|
4
|
+
const restoreAttributes = (element, svg) => {
|
5
|
+
const attributes = {};
|
6
|
+
element?.getAttributeNames().forEach((attribute) => {
|
7
|
+
if (attribute.startsWith("aria-") ||
|
8
|
+
attributesToRestore.includes(attribute)) {
|
9
|
+
attributes[attribute] = element.getAttribute(attribute);
|
10
|
+
}
|
11
|
+
});
|
12
|
+
Object.keys(attributes).forEach((attribute) => {
|
13
|
+
svg.setAttribute(attribute, attributes[attribute]);
|
14
|
+
});
|
15
|
+
};
|
16
|
+
export const svgInjector = (element, { beforeEach = () => { }, ...options } = {}) => {
|
17
|
+
SVGInjector(element, {
|
18
|
+
...options,
|
19
|
+
beforeEach: (svg) => {
|
20
|
+
DOMPurify.sanitize(svg, {
|
21
|
+
USE_PROFILES: { svg: true, svgFilters: true },
|
22
|
+
IN_PLACE: true,
|
23
|
+
});
|
24
|
+
restoreAttributes(element, svg);
|
25
|
+
beforeEach(svg);
|
26
|
+
},
|
27
|
+
});
|
28
|
+
};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import "@axa-fr/design-system-look-and-feel-css/dist/Tabs/Tabs.scss";
|
2
|
+
import { ReactNode } from "react";
|
3
|
+
export declare enum Direction {
|
4
|
+
center = "center"
|
5
|
+
}
|
6
|
+
type TabsProps = {
|
7
|
+
items: {
|
8
|
+
title: string;
|
9
|
+
content: string | ReactNode;
|
10
|
+
icon?: ReactNode;
|
11
|
+
}[];
|
12
|
+
preSelectedTabIndex?: number;
|
13
|
+
direction?: Direction;
|
14
|
+
};
|
15
|
+
export declare const TabsClient: ({ items, preSelectedTabIndex, direction, }: TabsProps) => import("react/jsx-runtime").JSX.Element;
|
16
|
+
export {};
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import "@axa-fr/design-system-look-and-feel-css/dist/Tabs/Tabs.scss";
|
3
|
+
import classNames from "classnames";
|
4
|
+
import { useCallback, useRef, useState } from "react";
|
5
|
+
export var Direction;
|
6
|
+
(function (Direction) {
|
7
|
+
Direction["center"] = "center";
|
8
|
+
})(Direction || (Direction = {}));
|
9
|
+
export const TabsClient = ({ items, preSelectedTabIndex, direction, }) => {
|
10
|
+
const [selectedTabIndex, setSelectedTabIndex] = useState(preSelectedTabIndex || 0);
|
11
|
+
const buttonRefs = useRef([]);
|
12
|
+
const tablistRef = useRef(null);
|
13
|
+
const totalTabs = items.length;
|
14
|
+
const isActive = (index) => index === selectedTabIndex;
|
15
|
+
const onChangeTab = useCallback((e) => {
|
16
|
+
const firstTabIndex = 0;
|
17
|
+
const lastTabIndex = totalTabs - 1;
|
18
|
+
const goToNextTab = (nextTabIndex) => {
|
19
|
+
setSelectedTabIndex(nextTabIndex);
|
20
|
+
buttonRefs.current[nextTabIndex].focus();
|
21
|
+
e.stopPropagation();
|
22
|
+
e.preventDefault();
|
23
|
+
};
|
24
|
+
switch (e.key) {
|
25
|
+
case "ArrowRight":
|
26
|
+
goToNextTab(selectedTabIndex < lastTabIndex
|
27
|
+
? selectedTabIndex + 1
|
28
|
+
: firstTabIndex);
|
29
|
+
break;
|
30
|
+
case "ArrowLeft":
|
31
|
+
goToNextTab(selectedTabIndex > firstTabIndex
|
32
|
+
? selectedTabIndex - 1
|
33
|
+
: lastTabIndex);
|
34
|
+
break;
|
35
|
+
case "Home":
|
36
|
+
goToNextTab(firstTabIndex);
|
37
|
+
break;
|
38
|
+
case "End":
|
39
|
+
goToNextTab(lastTabIndex);
|
40
|
+
break;
|
41
|
+
default:
|
42
|
+
break;
|
43
|
+
}
|
44
|
+
}, [selectedTabIndex, totalTabs]);
|
45
|
+
return (_jsxs("div", { className: classNames("af-tabs-client", direction === Direction.center ? `af-tabs-client--center` : ""), children: [_jsx("div", { role: "tablist", ref: tablistRef, children: items.map((item, index) => (_jsxs("button", { role: "tab", id: `tab-${index}`, "aria-selected": isActive(index), "aria-controls": `tabpanel-${index}`, onKeyDown: onChangeTab, onClick: () => setSelectedTabIndex(index), ref: (element) => {
|
46
|
+
buttonRefs.current[index] = element;
|
47
|
+
}, type: "button", tabIndex: isActive(index) ? 0 : -1, children: [item.icon, _jsx("span", { children: item.title })] }, `tab-${item.title}`))) }), items.map((item, index) => (_jsx("div", { role: "tabpanel", "aria-hidden": !isActive(index), id: `tabpanel-${index}`, "aria-labelledby": `tab-${index}`, children: item.content }, `tabpanel-${item.title}`)))] }));
|
48
|
+
};
|
package/dist/Tag/Tag.js
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { useMemo } from "react";
|
3
|
+
import { getComponentClassName } from "../utilities";
|
4
|
+
export const Tag = ({ children, className, classModifier = "", ...divProps }) => {
|
5
|
+
const componentClassName = useMemo(() => getComponentClassName(className, classModifier, "af-tag"), [className, classModifier]);
|
6
|
+
return (_jsx("div", { className: componentClassName, ...divProps, children: _jsx("span", { className: "af-tag__label", children: children }) }));
|
7
|
+
};
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { type ReactNode } from "react";
|
2
|
+
import { TitleSize, TitleLevel } from "./constants";
|
3
|
+
type TitleProps = {
|
4
|
+
children: ReactNode;
|
5
|
+
firstSubtitle?: string;
|
6
|
+
secondSubtitle?: string;
|
7
|
+
icon?: ReactNode;
|
8
|
+
className?: string;
|
9
|
+
classModifier?: string;
|
10
|
+
size?: TitleSize;
|
11
|
+
level?: TitleLevel;
|
12
|
+
};
|
13
|
+
export declare const Title: ({ children: title, className, classModifier, firstSubtitle, icon, secondSubtitle, size, level, }: TitleProps) => import("react/jsx-runtime").JSX.Element;
|
14
|
+
export {};
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useCallback, useMemo, } from "react";
|
3
|
+
import { IconBg } from "..";
|
4
|
+
import { getComponentClassName } from "../utilities";
|
5
|
+
import { TitleSize } from "./constants";
|
6
|
+
import { TitleWithSubtitles } from "./TitleWithSubtitles";
|
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]);
|
9
|
+
const TitleWithSubtitlesPart = useCallback(({ ...args }) => (_jsx(TitleWithSubtitles, { title: title, firstSubtitle: firstSubtitle, ...args })), [title, firstSubtitle]);
|
10
|
+
return (_jsx("div", { className: componentClassName, children: icon && size === TitleSize.XL ? (_jsxs(_Fragment, { children: [_jsx(IconBg, { className: "af-title__icon af-icon-bg", children: icon }), _jsx("div", { className: "af-title__text-container", children: _jsx(TitleWithSubtitlesPart, { secondSubtitle: secondSubtitle, level: level }) })] })) : (_jsx(TitleWithSubtitlesPart, { level: level })) }));
|
11
|
+
};
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { type ReactNode } from "react";
|
2
|
+
import { TitleLevel } from "./constants";
|
3
|
+
type TitleTextProps = {
|
4
|
+
title: ReactNode;
|
5
|
+
firstSubtitle?: string;
|
6
|
+
secondSubtitle?: string;
|
7
|
+
level?: TitleLevel;
|
8
|
+
};
|
9
|
+
export declare const TitleWithSubtitles: ({ title, firstSubtitle, secondSubtitle, level, }: TitleTextProps) => import("react/jsx-runtime").JSX.Element;
|
10
|
+
export {};
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useMemo } from "react";
|
3
|
+
export const TitleWithSubtitles = ({ title, firstSubtitle, secondSubtitle, level = 1, }) => {
|
4
|
+
const HLevel = useMemo(() => `h${level}`, [level]);
|
5
|
+
return (_jsxs(_Fragment, { children: [_jsx(HLevel, { className: "af-title__title", children: title }), firstSubtitle && (_jsx("span", { className: "af-title__subtitle", children: firstSubtitle })), secondSubtitle && (_jsx("span", { className: "af-title__subtitle", children: secondSubtitle }))] }));
|
6
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2m13 2h-2.5A3.5 3.5 0 0 0 12 8.5V11h-2v3h2v7h3v-7h3v-3h-3V9a1 1 0 0 1 1-1h2V5z"></path></svg>
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M19 3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14m-.5 15.5v-5.3a3.26 3.26 0 0 0-3.26-3.26c-.85 0-1.84.52-2.32 1.3v-1.11h-2.79v8.37h2.79v-4.93c0-.77.62-1.4 1.39-1.4a1.4 1.4 0 0 1 1.4 1.4v4.93h2.79M6.88 8.56a1.68 1.68 0 0 0 1.68-1.68c0-.93-.75-1.69-1.68-1.69a1.69 1.69 0 0 0-1.69 1.69c0 .93.76 1.68 1.69 1.68m1.39 9.94v-8.37H5.5v8.37h2.77z"></path></svg>
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"></path></svg>
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M10 15l5.19-3L10 9v6m11.56-7.83c.13.47.22 1.1.28 1.9.07.8.1 1.49.1 2.09L22 12c0 2.19-.16 3.8-.44 4.83-.25.9-.83 1.48-1.73 1.73-.47.13-1.33.22-2.65.28-1.3.07-2.49.1-3.59.1L12 19c-4.19 0-6.8-.16-7.83-.44-.9-.25-1.48-.83-1.73-1.73-.13-.47-.22-1.1-.28-1.9-.07-.8-.1-1.49-.1-2.09L2 12c0-2.19.16-3.8.44-4.83.25-.9.83-1.48 1.73-1.73.47-.13 1.33-.22 2.65-.28 1.3-.07 2.49-.1 3.59-.1L12 5c4.19 0 6.8.16 7.83.44.9.25 1.48.83 1.73 1.73z"></path></svg>
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
import "@fontsource/source-sans-pro";
|
2
|
+
export { Accordion } from "./Accordion";
|
3
|
+
export { AccordionCore } from "./AccordionCore";
|
4
|
+
export { Alert } from "./Alert/Alert";
|
5
|
+
export type { AlertType } from "./Alert/Alert";
|
6
|
+
export { ButtonClient as Button, Variants as ButtonVariants, } from "./Button/Button";
|
7
|
+
export { Card } from "./Card";
|
8
|
+
export { Checkbox, CheckboxSelect } from "./Form/Checkbox";
|
9
|
+
export { FileUpload } from "./Form/FileUpload";
|
10
|
+
export { Radio, RadioSelect } from "./Form/Radio";
|
11
|
+
export { Select } from "./Form/Select";
|
12
|
+
export { Text as TextInput } from "./Form/Text";
|
13
|
+
export { IconBg } from "./IconBg";
|
14
|
+
export { Footer } from "./Layout/Footer/Footer";
|
15
|
+
export { Header } from "./Layout/Header";
|
16
|
+
export { Link } from "./Link/Link";
|
17
|
+
export { List } from "./List";
|
18
|
+
export { ClickItem, ClickList } from "./List/ClickList";
|
19
|
+
export { ContentItemDuo } from "./List/ContentItemDuo";
|
20
|
+
export { ContentItemMono, ContentItemMonoSize } from "./List/ContentItemMono";
|
21
|
+
export { ContentTabList } from "./List/ContentTabList";
|
22
|
+
export { Loader } from "./Loader";
|
23
|
+
export { Modal } from "./ModalClient/Modal";
|
24
|
+
export type { ButtonAction as ModalButtonAction } from "./ModalClient/Modal";
|
25
|
+
export { Pagination } from "./Pagination/Pagination";
|
26
|
+
export { Stepper } from "./Stepper/Stepper";
|
27
|
+
export { Svg } from "./Svg";
|
28
|
+
export { TabsClient as Tabs } from "./Tabs/Tabs";
|
29
|
+
export { Tag } from "./Tag";
|
30
|
+
export { Title, TitleSize, type TitleLevel } from "./Title";
|
package/dist/index.js
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
import "@fontsource/source-sans-pro";
|
2
|
+
export { Accordion } from "./Accordion";
|
3
|
+
export { AccordionCore } from "./AccordionCore";
|
4
|
+
export { Alert } from "./Alert/Alert";
|
5
|
+
export { ButtonClient as Button, Variants as ButtonVariants, } from "./Button/Button";
|
6
|
+
export { Card } from "./Card";
|
7
|
+
export { Checkbox, CheckboxSelect } from "./Form/Checkbox";
|
8
|
+
export { FileUpload } from "./Form/FileUpload";
|
9
|
+
export { Radio, RadioSelect } from "./Form/Radio";
|
10
|
+
export { Select } from "./Form/Select";
|
11
|
+
export { Text as TextInput } from "./Form/Text";
|
12
|
+
export { IconBg } from "./IconBg";
|
13
|
+
export { Footer } from "./Layout/Footer/Footer";
|
14
|
+
export { Header } from "./Layout/Header";
|
15
|
+
export { Link } from "./Link/Link";
|
16
|
+
export { List } from "./List";
|
17
|
+
export { ClickItem, ClickList } from "./List/ClickList";
|
18
|
+
export { ContentItemDuo } from "./List/ContentItemDuo";
|
19
|
+
export { ContentItemMono, ContentItemMonoSize } from "./List/ContentItemMono";
|
20
|
+
export { ContentTabList } from "./List/ContentTabList";
|
21
|
+
export { Loader } from "./Loader";
|
22
|
+
export { Modal } from "./ModalClient/Modal";
|
23
|
+
export { Pagination } from "./Pagination/Pagination";
|
24
|
+
export { Stepper } from "./Stepper/Stepper";
|
25
|
+
export { Svg } from "./Svg";
|
26
|
+
export { TabsClient as Tabs } from "./Tabs/Tabs";
|
27
|
+
export { Tag } from "./Tag";
|
28
|
+
export { Title, TitleSize } from "./Title";
|
@@ -0,0 +1,7 @@
|
|
1
|
+
export var BREAKPOINT;
|
2
|
+
(function (BREAKPOINT) {
|
3
|
+
BREAKPOINT[BREAKPOINT["SM"] = 667] = "SM";
|
4
|
+
BREAKPOINT[BREAKPOINT["MD"] = 1023] = "MD";
|
5
|
+
BREAKPOINT[BREAKPOINT["LG"] = 1279] = "LG";
|
6
|
+
BREAKPOINT[BREAKPOINT["XL"] = 1599] = "XL";
|
7
|
+
})(BREAKPOINT || (BREAKPOINT = {}));
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const getComponentClassName: (className?: string, classModifier?: string, defaultClassName?: string) => string;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import classNames from "classnames";
|
2
|
+
const getLastClassName = (classNameToUse) => {
|
3
|
+
if (!classNameToUse) {
|
4
|
+
return null;
|
5
|
+
}
|
6
|
+
return classNameToUse.split(" ").filter(Boolean).at(-1);
|
7
|
+
};
|
8
|
+
const listClassModifier = (classModifier) => {
|
9
|
+
if (!classModifier) {
|
10
|
+
return [];
|
11
|
+
}
|
12
|
+
return classModifier.split(" ");
|
13
|
+
};
|
14
|
+
export const getComponentClassName = (className, classModifier, defaultClassName) => {
|
15
|
+
const classNameToUse = className || defaultClassName;
|
16
|
+
if (!classNameToUse) {
|
17
|
+
return "";
|
18
|
+
}
|
19
|
+
const classWithoutModifier = getLastClassName(classNameToUse);
|
20
|
+
const modifiers = listClassModifier(classModifier);
|
21
|
+
const modifiersObject = modifiers
|
22
|
+
.filter((it) => /\S/.test(it))
|
23
|
+
.map((it) => {
|
24
|
+
return `${classWithoutModifier}--${it}`;
|
25
|
+
});
|
26
|
+
return classNames(classNameToUse, modifiersObject);
|
27
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const useIsSmallScreen: (breakPointToCheck: number) => boolean;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { useCallback, useSyncExternalStore } from "react";
|
2
|
+
export const useIsSmallScreen = (breakPointToCheck) => {
|
3
|
+
const subscribe = useCallback((listener) => {
|
4
|
+
window.addEventListener("resize", listener);
|
5
|
+
return () => {
|
6
|
+
window.removeEventListener("resize", listener);
|
7
|
+
};
|
8
|
+
}, []);
|
9
|
+
const getSnapshot = useCallback(() => {
|
10
|
+
return window.innerWidth <= breakPointToCheck;
|
11
|
+
}, [breakPointToCheck]);
|
12
|
+
const getServerSnapshot = useCallback(() => false, []);
|
13
|
+
return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
14
|
+
};
|
package/package.json
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
{
|
2
|
+
"name": "@axa-fr/design-system-look-and-feel-react",
|
3
|
+
"version": "0.1.1",
|
4
|
+
"description": "",
|
5
|
+
"exports": {
|
6
|
+
".": {
|
7
|
+
"import": "./dist/index.js",
|
8
|
+
"types": "./dist/index.d.ts"
|
9
|
+
},
|
10
|
+
"./utilities": {
|
11
|
+
"import": "./dist/utilities.js",
|
12
|
+
"types": "./dist/utilities.d.ts"
|
13
|
+
}
|
14
|
+
},
|
15
|
+
"files": [
|
16
|
+
"dist"
|
17
|
+
],
|
18
|
+
"scripts": {
|
19
|
+
"prebuild": "rimraf dist",
|
20
|
+
"build": "tsc -p tsconfig.build.json",
|
21
|
+
"postbuild": "copyfiles --up 1 \"src/assets/svg/*.svg\" ./dist/",
|
22
|
+
"start:storybook": "storybook dev -p 6009",
|
23
|
+
"build:storybook": "storybook build",
|
24
|
+
"eslint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
|
25
|
+
"eslint:fix": "eslint src --ext js,jsx,ts,tsx --fix",
|
26
|
+
"prettier": "prettier \"src/**/*.!(js|jsx|ts|tsx|svg)\" --check",
|
27
|
+
"prettier:fix": "prettier \"src/**/*.!(js|jsx|ts|tsx|svg)\" --write",
|
28
|
+
"tsc": "tsc --noEmit",
|
29
|
+
"test": "vitest",
|
30
|
+
"test:ui": "vitest --ui",
|
31
|
+
"test:ci": "vitest run --coverage"
|
32
|
+
},
|
33
|
+
"repository": {
|
34
|
+
"type": "git",
|
35
|
+
"url": "git+https://github.com/AxaFrance/design-system.git"
|
36
|
+
},
|
37
|
+
"author": "AxaFrance",
|
38
|
+
"license": "MIT",
|
39
|
+
"bugs": {
|
40
|
+
"url": "https://github.com/AxaFrance/design-system/issues"
|
41
|
+
},
|
42
|
+
"homepage": "https://github.com/AxaFrance/design-system#readme",
|
43
|
+
"peerDependencies": {
|
44
|
+
"@axa-fr/design-system-look-and-feel-css": "0.1.1+277",
|
45
|
+
"@material-symbols/svg-400": ">= 0.19.0",
|
46
|
+
"react": ">= 18"
|
47
|
+
},
|
48
|
+
"peerDependenciesMeta": {
|
49
|
+
"@material-symbols/svg-400": {
|
50
|
+
"optional": true
|
51
|
+
}
|
52
|
+
},
|
53
|
+
"dependencies": {
|
54
|
+
"@fontsource/source-sans-pro": "^5.0.8",
|
55
|
+
"@tanem/svg-injector": "^10.1.68",
|
56
|
+
"classnames": "^2.5.1",
|
57
|
+
"dompurify": "^3.1.5",
|
58
|
+
"rc-slider": "^10.5.0",
|
59
|
+
"react-select": "^5.8.0"
|
60
|
+
},
|
61
|
+
"devDependencies": {
|
62
|
+
"@chromatic-com/storybook": "^1.9.0",
|
63
|
+
"@material-symbols/svg-400": "*",
|
64
|
+
"@storybook/addon-docs": "^8.3.5",
|
65
|
+
"@storybook/addon-essentials": "^8.3.5",
|
66
|
+
"@storybook/addon-interactions": "^8.3.5",
|
67
|
+
"@storybook/addon-links": "^8.3.5",
|
68
|
+
"@storybook/addon-mdx-gfm": "^8.3.5",
|
69
|
+
"@storybook/addon-onboarding": "^8.3.5",
|
70
|
+
"@storybook/addons": "^7.6.17",
|
71
|
+
"@storybook/blocks": "^8.3.5",
|
72
|
+
"@storybook/manager-api": "^8.3.5",
|
73
|
+
"@storybook/react": "^8.3.5",
|
74
|
+
"@storybook/react-vite": "^8.3.5",
|
75
|
+
"@storybook/test": "^8.3.5",
|
76
|
+
"@storybook/theming": "^8.3.5",
|
77
|
+
"@testing-library/dom": "^10.1.0",
|
78
|
+
"@testing-library/jest-dom": "^6.5.0",
|
79
|
+
"@testing-library/react": "^15.0.7",
|
80
|
+
"@testing-library/user-event": "^14.5.2",
|
81
|
+
"@types/dompurify": "^3.0.5",
|
82
|
+
"@types/jest": "^29.5.12",
|
83
|
+
"@types/jest-axe": "^3.5.9",
|
84
|
+
"@types/node": "^20.14.9",
|
85
|
+
"@types/react": "^18.3.2",
|
86
|
+
"@typescript-eslint/eslint-plugin": "^7.17.0",
|
87
|
+
"@typescript-eslint/parser": "^7.16.0",
|
88
|
+
"@vitejs/plugin-react": "^4.3.1",
|
89
|
+
"@vitest/coverage-v8": "^2.0.5",
|
90
|
+
"@vitest/ui": "^2.1.2",
|
91
|
+
"copyfiles": "^2.4.1",
|
92
|
+
"eslint": "^8.57.0",
|
93
|
+
"eslint-config-airbnb": "^19.0.4",
|
94
|
+
"eslint-config-prettier": "^9.1.0",
|
95
|
+
"eslint-import-resolver-typescript": "^3.6.1",
|
96
|
+
"eslint-plugin-import": "^2.29.1",
|
97
|
+
"eslint-plugin-jsx-a11y": "^6.8.0",
|
98
|
+
"eslint-plugin-prettier": "^5.1.3",
|
99
|
+
"eslint-plugin-react": "^7.36.1",
|
100
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
101
|
+
"eslint-plugin-storybook": "^0.9.0",
|
102
|
+
"jest-axe": "^8.0.0",
|
103
|
+
"jsdom": "^25.0.1",
|
104
|
+
"prettier": "^3.3.3",
|
105
|
+
"prop-types": "^15.8.1",
|
106
|
+
"react": "^18.3.1",
|
107
|
+
"react-dom": "^18.2.0",
|
108
|
+
"rimraf": "^6.0.1",
|
109
|
+
"storybook": "^8.3.5",
|
110
|
+
"tsc-files": "^1.1.4",
|
111
|
+
"typescript": "^5.6.3",
|
112
|
+
"vitest": "^2.0.5"
|
113
|
+
},
|
114
|
+
"lint-staged": {
|
115
|
+
"*.(js|jsx|ts|tsx)": "eslint --fix",
|
116
|
+
"*.(ts|tsx)": "tsc-files --noEmit",
|
117
|
+
"*.mdx": "prettier --write"
|
118
|
+
},
|
119
|
+
"volta": {
|
120
|
+
"node": "20.10.0",
|
121
|
+
"npm": "10.2.5"
|
122
|
+
}
|
123
|
+
}
|