@axa-fr/design-system-look-and-feel-react 0.2.0-beta.339 → 0.2.0-beta.347
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/package.json +21 -17
- package/dist/Accordion/Accordion.stories.d.ts +0 -7
- package/dist/Accordion/Accordion.stories.js +0 -40
- package/dist/Accordion/__tests__/Accordion.test.d.ts +0 -1
- package/dist/Accordion/__tests__/Accordion.test.js +0 -50
- package/dist/Accordion/__tests__/AccordionTagDateContainer.test.d.ts +0 -1
- package/dist/Accordion/__tests__/AccordionTagDateContainer.test.js +0 -23
- package/dist/AccordionCore/AccordionCore.stories.d.ts +0 -8
- package/dist/AccordionCore/AccordionCore.stories.js +0 -41
- package/dist/AccordionCore/__tests__/AccordionCore.test.d.ts +0 -1
- package/dist/AccordionCore/__tests__/AccordionCore.test.js +0 -47
- package/dist/Alert/Alert.stories.d.ts +0 -6
- package/dist/Alert/Alert.stories.js +0 -37
- package/dist/Alert/__tests__/Alert.test.d.ts +0 -1
- package/dist/Alert/__tests__/Alert.test.js +0 -33
- package/dist/Button/Button.stories.d.ts +0 -22
- package/dist/Button/Button.stories.js +0 -99
- package/dist/Card/Card.stories.d.ts +0 -6
- package/dist/Card/Card.stories.js +0 -40
- package/dist/Card/__tests__/Card.test.d.ts +0 -1
- package/dist/Card/__tests__/Card.test.js +0 -27
- package/dist/Form/Checkbox/Checkbox.stories.d.ts +0 -6
- package/dist/Form/Checkbox/Checkbox.stories.js +0 -38
- package/dist/Form/Checkbox/CheckboxSelect.stories.d.ts +0 -6
- package/dist/Form/Checkbox/CheckboxSelect.stories.js +0 -55
- package/dist/Form/FileUpload/FIleUpload.stories.d.ts +0 -6
- package/dist/Form/FileUpload/FIleUpload.stories.js +0 -54
- package/dist/Form/InputError/InputError.stories.d.ts +0 -5
- package/dist/Form/InputError/InputError.stories.js +0 -12
- package/dist/Form/Radio/Radio.stories.d.ts +0 -6
- package/dist/Form/Radio/Radio.stories.js +0 -38
- package/dist/Form/Radio/RadioSelect.stories.d.ts +0 -8
- package/dist/Form/Radio/RadioSelect.stories.js +0 -112
- package/dist/Form/Select/Select.stories.d.ts +0 -10
- package/dist/Form/Select/Select.stories.js +0 -31
- package/dist/Form/Text/Text.stories.d.ts +0 -9
- package/dist/Form/Text/Text.stories.js +0 -51
- package/dist/IconBg/IconBg.stories.d.ts +0 -5
- package/dist/IconBg/IconBg.stories.js +0 -23
- package/dist/IconBg/__tests__/IconBg.test.d.ts +0 -1
- package/dist/IconBg/__tests__/IconBg.test.js +0 -22
- package/dist/Layout/Footer/Footer.stories.d.ts +0 -14
- package/dist/Layout/Footer/Footer.stories.js +0 -48
- package/dist/Layout/Header/Header.stories.d.ts +0 -10
- package/dist/Layout/Header/Header.stories.js +0 -52
- package/dist/Layout/Header/NavBar/NavBar.stories.d.ts +0 -8
- package/dist/Layout/Header/NavBar/NavBar.stories.js +0 -17
- package/dist/Layout/Header/PreviousLink/PreviousLink.stories.d.ts +0 -8
- package/dist/Layout/Header/PreviousLink/PreviousLink.stories.js +0 -16
- package/dist/Link/Link.stories.d.ts +0 -5
- package/dist/Link/Link.stories.js +0 -14
- package/dist/List/ClickList/ClickItem/__tests__/ClickItem.test.d.ts +0 -1
- package/dist/List/ClickList/ClickItem/__tests__/ClickItem.test.js +0 -62
- package/dist/List/ClickList/ClickList.stories.d.ts +0 -7
- package/dist/List/ClickList/ClickList.stories.js +0 -103
- package/dist/List/ClickList/__tests__/ClickList.client.test.d.ts +0 -1
- package/dist/List/ClickList/__tests__/ClickList.client.test.js +0 -18
- package/dist/List/ContentItemDuo/ContentItemDuo.stories.d.ts +0 -28
- package/dist/List/ContentItemDuo/ContentItemDuo.stories.js +0 -86
- package/dist/List/ContentItemDuo/__tests__/ContentItemDuo.test.d.ts +0 -1
- package/dist/List/ContentItemDuo/__tests__/ContentItemDuo.test.js +0 -40
- package/dist/List/ContentItemMono/ContentItemMono.stories.d.ts +0 -16
- package/dist/List/ContentItemMono/ContentItemMono.stories.js +0 -99
- package/dist/List/ContentItemMono/__tests__/ContentItemMono.test.d.ts +0 -1
- package/dist/List/ContentItemMono/__tests__/ContentItemMono.test.js +0 -45
- package/dist/List/ContentTabList/ContentTabItem/__tests__/ContentTabItem.test.d.ts +0 -1
- package/dist/List/ContentTabList/ContentTabItem/__tests__/ContentTabItem.test.js +0 -100
- package/dist/List/ContentTabList/ContentTabList.stories.d.ts +0 -7
- package/dist/List/ContentTabList/ContentTabList.stories.js +0 -78
- package/dist/List/ContentTabList/__tests__/ContentTabList.test.d.ts +0 -1
- package/dist/List/ContentTabList/__tests__/ContentTabList.test.js +0 -57
- package/dist/List/List.stories.d.ts +0 -8
- package/dist/List/List.stories.js +0 -31
- package/dist/List/__tests__/List.test.d.ts +0 -1
- package/dist/List/__tests__/List.test.js +0 -30
- package/dist/Loader/Loader.stories.d.ts +0 -6
- package/dist/Loader/Loader.stories.js +0 -15
- package/dist/ModalClient/Modal.stories.d.ts +0 -7
- package/dist/ModalClient/Modal.stories.js +0 -37
- package/dist/Pagination/Pagination.stories.d.ts +0 -11
- package/dist/Pagination/Pagination.stories.js +0 -19
- package/dist/Stepper/Stepper.stories.d.ts +0 -16
- package/dist/Stepper/Stepper.stories.js +0 -23
- package/dist/Svg/Svg.stories.d.ts +0 -7
- package/dist/Svg/Svg.stories.js +0 -40
- package/dist/Svg/__tests__/Svg.test.d.ts +0 -1
- package/dist/Svg/__tests__/Svg.test.js +0 -38
- package/dist/Tabs/Tabs.stories.d.ts +0 -17
- package/dist/Tabs/Tabs.stories.js +0 -89
- package/dist/Tag/Tag.stories.d.ts +0 -5
- package/dist/Tag/Tag.stories.js +0 -22
- package/dist/Tag/__test__/Tag.test.d.ts +0 -1
- package/dist/Tag/__test__/Tag.test.js +0 -18
- package/dist/Title/Title.stories.d.ts +0 -6
- package/dist/Title/Title.stories.js +0 -45
- package/dist/Title/__tests__/Title.test.d.ts +0 -1
- package/dist/Title/__tests__/Title.test.js +0 -28
- package/dist/Title/__tests__/TitleWithSubtitles.test.d.ts +0 -1
- package/dist/Title/__tests__/TitleWithSubtitles.test.js +0 -14
@@ -1,17 +0,0 @@
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import { NavBar } from "./NavBar";
|
3
|
-
const meta = {
|
4
|
-
title: "Components/Header/NavBar",
|
5
|
-
component: NavBar,
|
6
|
-
argTypes: {
|
7
|
-
setActiveLink: { action: "active link changed" },
|
8
|
-
activeLink: { control: { type: "number", min: 0, max: 3 } },
|
9
|
-
},
|
10
|
-
};
|
11
|
-
export default meta;
|
12
|
-
export const Default = {
|
13
|
-
render: ({ activeLink, setActiveLink }) => (_jsxs(NavBar, { activeLink: activeLink, setActiveLink: setActiveLink, children: [_jsx("a", { className: "af-navbar-item__link", href: "/mes-contrats", children: "MES CONTRATS" }, "MES CONTRATS link"), _jsx("a", { className: "af-navbar-item__link", href: "/mes-avantages", children: "MES AVANTAGES" }, "MES AVANTAGES link"), _jsx("a", { className: "af-navbar-item__link", href: "/mes-documents", children: "MES DOCUMENTS" }, "MES DOCUMENTS link")] })),
|
14
|
-
args: {
|
15
|
-
activeLink: 0,
|
16
|
-
},
|
17
|
-
};
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
2
|
-
import type React from "react";
|
3
|
-
import { PreviousLink } from "./PreviousLink";
|
4
|
-
declare const meta: Meta<typeof PreviousLink>;
|
5
|
-
export default meta;
|
6
|
-
type StoryProps = React.ComponentProps<typeof PreviousLink>;
|
7
|
-
type Story = StoryObj<StoryProps>;
|
8
|
-
export declare const Default: Story;
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import { PreviousLink } from "./PreviousLink";
|
3
|
-
const meta = {
|
4
|
-
title: "Components/Header/PreviousLink",
|
5
|
-
component: PreviousLink,
|
6
|
-
argTypes: {
|
7
|
-
handleClick: { action: "active link reset" },
|
8
|
-
},
|
9
|
-
};
|
10
|
-
export default meta;
|
11
|
-
export const Default = {
|
12
|
-
render: ({ children, handleClick }) => (_jsx(PreviousLink, { handleClick: handleClick, children: children })),
|
13
|
-
args: {
|
14
|
-
children: (_jsx("a", { href: "/mes-contrats", children: "Retour \u00E0 mes contrats" }, "Previous link")),
|
15
|
-
},
|
16
|
-
};
|
@@ -1,14 +0,0 @@
|
|
1
|
-
import { Link } from "./Link";
|
2
|
-
const meta = {
|
3
|
-
title: "Components/Link",
|
4
|
-
component: Link,
|
5
|
-
};
|
6
|
-
export default meta;
|
7
|
-
export const Default = {
|
8
|
-
name: "Default",
|
9
|
-
args: {
|
10
|
-
href: "https://fakelink.com",
|
11
|
-
openInNewTab: true,
|
12
|
-
children: "My link",
|
13
|
-
},
|
14
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,62 +0,0 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import { render, screen } from "@testing-library/react";
|
3
|
-
import { ClickItem } from "../ClickItem";
|
4
|
-
describe("ClickItem", () => {
|
5
|
-
it("should render label correctly with children prop", () => {
|
6
|
-
const label = "Sample Label";
|
7
|
-
render(_jsx(ClickItem, { children: label }));
|
8
|
-
const labelElement = screen.getByText(label);
|
9
|
-
expect(labelElement).toBeInTheDocument();
|
10
|
-
});
|
11
|
-
it("should render label correctly with label prop", () => {
|
12
|
-
const label = "Sample Label";
|
13
|
-
render(_jsx(ClickItem, { label: label }));
|
14
|
-
const labelElement = screen.getByText(label);
|
15
|
-
expect(labelElement).toBeInTheDocument();
|
16
|
-
});
|
17
|
-
it("should have custom class with modifier", () => {
|
18
|
-
const label = "Sample Label";
|
19
|
-
const className = "custom-class";
|
20
|
-
const classModifier = "modifier";
|
21
|
-
render(_jsx(ClickItem, { className: className, classModifier: classModifier, children: label }));
|
22
|
-
expect(screen.getByRole("button", { name: label })).toHaveClass(`${className} ${className}--${classModifier}`);
|
23
|
-
});
|
24
|
-
it("should render icon correctly", () => {
|
25
|
-
const label = "Sample Label";
|
26
|
-
const icon = _jsx("span", { children: "Icon" });
|
27
|
-
render(_jsx(ClickItem, { icon: icon, children: label }));
|
28
|
-
const iconElement = screen.getByText("Icon");
|
29
|
-
expect(iconElement).toBeInTheDocument();
|
30
|
-
});
|
31
|
-
it("should render as a button by default", () => {
|
32
|
-
const label = "Sample Label";
|
33
|
-
render(_jsx(ClickItem, { children: label }));
|
34
|
-
const buttonElement = screen.getByRole("button", { name: label });
|
35
|
-
expect(buttonElement).toBeInTheDocument();
|
36
|
-
});
|
37
|
-
it("should render as a link when href is provided", () => {
|
38
|
-
const label = "Sample Label";
|
39
|
-
const href = "https://example.com";
|
40
|
-
render(_jsx(ClickItem, { href: href, children: label }));
|
41
|
-
const linkElement = screen.getByRole("link", { name: label });
|
42
|
-
expect(linkElement).toBeInTheDocument();
|
43
|
-
expect(linkElement).toHaveAttribute("href", href);
|
44
|
-
});
|
45
|
-
it("should be a disabled anchor", () => {
|
46
|
-
const label = "Sample Label";
|
47
|
-
const href = "https://example.com";
|
48
|
-
const disabled = true;
|
49
|
-
render(_jsx(ClickItem, { href: href, isDisabled: disabled, children: label }));
|
50
|
-
const anchorElement = screen.getByRole("link", { name: label });
|
51
|
-
expect(anchorElement).toHaveClass("af-click-item--disabled");
|
52
|
-
expect(anchorElement).toHaveAttribute("aria-disabled", "true");
|
53
|
-
});
|
54
|
-
it("should be a disabled button", () => {
|
55
|
-
const label = "Sample Label";
|
56
|
-
const disabled = true;
|
57
|
-
render(_jsx(ClickItem, { isDisabled: disabled, children: label }));
|
58
|
-
const buttonElement = screen.getByRole("button", { name: label });
|
59
|
-
expect(buttonElement).toBeDisabled();
|
60
|
-
expect(buttonElement).toHaveClass("af-click-item--disabled");
|
61
|
-
});
|
62
|
-
});
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
2
|
-
import { ClickList } from "./ClickList";
|
3
|
-
declare const meta: Meta<typeof ClickList>;
|
4
|
-
export default meta;
|
5
|
-
export declare const ClickListWithIcon: StoryObj<typeof ClickList>;
|
6
|
-
export declare const ClickListWithoutIcon: StoryObj<typeof ClickList>;
|
7
|
-
export declare const ClickListLinkWithoutIcon: StoryObj<typeof ClickList>;
|
@@ -1,103 +0,0 @@
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import contentPasteGo from "@material-symbols/svg-400/outlined/content_paste_go.svg";
|
3
|
-
import error from "@material-symbols/svg-400/outlined/error-fill.svg";
|
4
|
-
import { Svg } from "../../Svg";
|
5
|
-
import { ClickList } from "./ClickList";
|
6
|
-
const meta = {
|
7
|
-
title: "Components/List/ClickList",
|
8
|
-
component: ClickList,
|
9
|
-
};
|
10
|
-
export default meta;
|
11
|
-
export const ClickListWithIcon = {
|
12
|
-
name: "ClickList with icon",
|
13
|
-
render: (args) => _jsx(ClickList, { ...args }),
|
14
|
-
args: {
|
15
|
-
items: [
|
16
|
-
{
|
17
|
-
id: "1",
|
18
|
-
icon: _jsx(Svg, { src: error }),
|
19
|
-
children: "Texte principal",
|
20
|
-
classModifier: "small",
|
21
|
-
},
|
22
|
-
{
|
23
|
-
id: "2",
|
24
|
-
icon: _jsx(Svg, { src: error }),
|
25
|
-
children: "Texte principal",
|
26
|
-
},
|
27
|
-
{
|
28
|
-
id: "3",
|
29
|
-
icon: _jsx(Svg, { src: error }),
|
30
|
-
children: "Texte principal",
|
31
|
-
classModifier: "large",
|
32
|
-
},
|
33
|
-
{
|
34
|
-
id: "4",
|
35
|
-
icon: _jsx(Svg, { src: contentPasteGo }),
|
36
|
-
children: "Texte principal",
|
37
|
-
isDisabled: true,
|
38
|
-
},
|
39
|
-
],
|
40
|
-
classModifier: "",
|
41
|
-
},
|
42
|
-
argTypes: {
|
43
|
-
classModifier: {
|
44
|
-
options: ["", "large"],
|
45
|
-
control: { type: "select" },
|
46
|
-
defaultValue: "",
|
47
|
-
},
|
48
|
-
},
|
49
|
-
};
|
50
|
-
export const ClickListWithoutIcon = {
|
51
|
-
name: "ClickList without icon",
|
52
|
-
render: (args) => _jsx(ClickList, { ...args }),
|
53
|
-
args: {
|
54
|
-
items: [
|
55
|
-
{
|
56
|
-
id: "1",
|
57
|
-
children: (_jsxs(_Fragment, { children: [_jsx("h3", { className: "af-click-item__title", children: "Fiche Orias pr\u00E9contractuelle" }), _jsx("p", { className: "af-click-item__subtitle", children: "30 novembre 2021" }), _jsx("p", { className: "af-click-item__secondary", children: "Sign\u00E9 \u00E9lectroniquement" })] })),
|
58
|
-
},
|
59
|
-
{
|
60
|
-
id: "2",
|
61
|
-
children: (_jsxs(_Fragment, { children: [_jsx("h3", { className: "af-click-item__title", children: "Fiche Orias pr\u00E9contractuelle" }), _jsx("p", { className: "af-click-item__subtitle", children: "30 novembre 2021" }), _jsx("p", { className: "af-click-item__secondary", children: "Sign\u00E9 \u00E9lectroniquement" })] })),
|
62
|
-
isDisabled: true,
|
63
|
-
},
|
64
|
-
],
|
65
|
-
classModifier: "",
|
66
|
-
},
|
67
|
-
argTypes: {
|
68
|
-
classModifier: {
|
69
|
-
options: ["", "large"],
|
70
|
-
control: { type: "select" },
|
71
|
-
defaultValue: "",
|
72
|
-
},
|
73
|
-
},
|
74
|
-
};
|
75
|
-
export const ClickListLinkWithoutIcon = {
|
76
|
-
name: "ClickList link without icon",
|
77
|
-
render: (args) => _jsx(ClickList, { ...args }),
|
78
|
-
args: {
|
79
|
-
items: [
|
80
|
-
{
|
81
|
-
id: "1",
|
82
|
-
children: (_jsxs(_Fragment, { children: [_jsx("h3", { className: "af-click-item__title", children: "Fiche Orias pr\u00E9contractuelle" }), _jsx("p", { className: "af-click-item__subtitle", children: "30 novembre 2021" }), _jsx("p", { className: "af-click-item__secondary", children: "Sign\u00E9 \u00E9lectroniquement" })] })),
|
83
|
-
href: "https://github.com/AxaFrance/design-system",
|
84
|
-
target: "_blank",
|
85
|
-
},
|
86
|
-
{
|
87
|
-
id: "2",
|
88
|
-
children: (_jsxs(_Fragment, { children: [_jsx("h3", { className: "af-click-item__title", children: "Fiche Orias pr\u00E9contractuelle" }), _jsx("p", { className: "af-click-item__subtitle", children: "30 novembre 2021" }), _jsx("p", { className: "af-click-item__secondary", children: "Sign\u00E9 \u00E9lectroniquement" })] })),
|
89
|
-
href: "https://github.com/AxaFrance/design-system",
|
90
|
-
target: "_blank",
|
91
|
-
isDisabled: true,
|
92
|
-
},
|
93
|
-
],
|
94
|
-
classModifier: "",
|
95
|
-
},
|
96
|
-
argTypes: {
|
97
|
-
classModifier: {
|
98
|
-
options: ["", "large"],
|
99
|
-
control: { type: "select" },
|
100
|
-
defaultValue: "",
|
101
|
-
},
|
102
|
-
},
|
103
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,18 +0,0 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import { render, screen } from "@testing-library/react";
|
3
|
-
import { ClickList } from "..";
|
4
|
-
describe("ClickList", () => {
|
5
|
-
const items = [
|
6
|
-
{ id: "1", label: "Item 1", icon: _jsx("span", { children: "Icon 1" }) },
|
7
|
-
{ id: "2", label: "Item 2", icon: _jsx("span", { children: "Icon 2" }) },
|
8
|
-
{ id: "3", label: "Item 3", icon: _jsx("span", { children: "Icon 3" }) },
|
9
|
-
];
|
10
|
-
it("should render labels and icons from items array", () => {
|
11
|
-
render(_jsx(ClickList, { items: items }));
|
12
|
-
items.forEach((item) => {
|
13
|
-
expect(screen.getByText(item.icon.props.children)).toBeInTheDocument();
|
14
|
-
expect(screen.getByText(item.label)).toBeInTheDocument();
|
15
|
-
});
|
16
|
-
expect(screen.getAllByRole("separator")).toHaveLength(2);
|
17
|
-
});
|
18
|
-
});
|
@@ -1,28 +0,0 @@
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react";
|
2
|
-
import type { ComponentProps } from "react";
|
3
|
-
import { ContentItemDuo } from ".";
|
4
|
-
import { List } from "../List";
|
5
|
-
declare const meta: Meta<typeof ContentItemDuo>;
|
6
|
-
export default meta;
|
7
|
-
export declare const Default: StoryObj<Omit<ComponentProps<typeof ContentItemDuo>, "classModifier"> & {
|
8
|
-
classModifier: string[];
|
9
|
-
}>;
|
10
|
-
export declare const Vertical: StoryObj<Omit<ComponentProps<typeof ContentItemDuo>, "classModifier"> & {
|
11
|
-
classModifier: string[];
|
12
|
-
}>;
|
13
|
-
export declare const DefaultContentItemDuoList: StoryObj<{
|
14
|
-
items: Array<Omit<ComponentProps<typeof ContentItemDuo>, "classModifier"> & {
|
15
|
-
id: string;
|
16
|
-
classModifier: string[];
|
17
|
-
}>;
|
18
|
-
} & Omit<ComponentProps<typeof List>, "classModifier"> & {
|
19
|
-
classModifier: string[];
|
20
|
-
}>;
|
21
|
-
export declare const VerticalContentItemDuoList: StoryObj<{
|
22
|
-
items: Array<Omit<ComponentProps<typeof ContentItemDuo>, "classModifier"> & {
|
23
|
-
id: string;
|
24
|
-
classModifier: string[];
|
25
|
-
}>;
|
26
|
-
} & Omit<ComponentProps<typeof List>, "classModifier"> & {
|
27
|
-
classModifier: string[];
|
28
|
-
}>;
|
@@ -1,86 +0,0 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import { ContentItemDuo } from ".";
|
3
|
-
import { List } from "../List";
|
4
|
-
const meta = {
|
5
|
-
title: "Components/List/ContentItemDuo",
|
6
|
-
component: ContentItemDuo,
|
7
|
-
};
|
8
|
-
export default meta;
|
9
|
-
const defaultArgs = {
|
10
|
-
isVertical: false,
|
11
|
-
label: "Libellé",
|
12
|
-
value: "Réponse",
|
13
|
-
isShowingDoneIcon: true,
|
14
|
-
isShowingCloseIcon: false,
|
15
|
-
buttonText: "En savoir plus",
|
16
|
-
classModifier: [],
|
17
|
-
};
|
18
|
-
const verticalArgs = {
|
19
|
-
isVertical: true,
|
20
|
-
label: "Le choc de véhicules terrestres à moteur, (voiture, trottinette à moteur…) ou la chute d’appareils aériens (avions, hélicoptères…) avec un propriétaire du véhicule adverse identifié ?",
|
21
|
-
value: "Les incendies, explosions, implosions, fumée et foudre",
|
22
|
-
isShowingDoneIcon: true,
|
23
|
-
isShowingCloseIcon: false,
|
24
|
-
buttonText: "En savoir plus",
|
25
|
-
classModifier: [],
|
26
|
-
};
|
27
|
-
export const Default = {
|
28
|
-
name: "Default",
|
29
|
-
render: ({ classModifier, ...args }) => (_jsx(ContentItemDuo, { classModifier: classModifier.join(" "), ...args })),
|
30
|
-
args: defaultArgs,
|
31
|
-
argTypes: {
|
32
|
-
classModifier: {
|
33
|
-
options: ["large"],
|
34
|
-
control: { type: "multi-select" },
|
35
|
-
defaultValue: [],
|
36
|
-
},
|
37
|
-
},
|
38
|
-
};
|
39
|
-
export const Vertical = {
|
40
|
-
name: "Vertical",
|
41
|
-
render: ({ classModifier, ...args }) => (_jsx(ContentItemDuo, { classModifier: classModifier.join(" "), ...args })),
|
42
|
-
args: verticalArgs,
|
43
|
-
argTypes: {
|
44
|
-
classModifier: {
|
45
|
-
options: ["large"],
|
46
|
-
control: { type: "multi-select" },
|
47
|
-
defaultValue: [],
|
48
|
-
},
|
49
|
-
},
|
50
|
-
};
|
51
|
-
export const DefaultContentItemDuoList = {
|
52
|
-
name: "Default ContentItemDuo List",
|
53
|
-
render: ({ classModifier, items }) => (_jsx(List, { classModifier: classModifier.join(" "), children: items.map(({ classModifier: itemClassModifier, ...itemArgs }) => (_jsx(ContentItemDuo, { classModifier: itemClassModifier.join(" "), ...itemArgs }, itemArgs.id))) })),
|
54
|
-
args: {
|
55
|
-
items: Array.from({ length: 3 }, (_, i) => ({
|
56
|
-
id: i.toString(),
|
57
|
-
...defaultArgs,
|
58
|
-
})),
|
59
|
-
classModifier: ["extra-padding"],
|
60
|
-
},
|
61
|
-
argTypes: {
|
62
|
-
classModifier: {
|
63
|
-
options: ["extra-padding", "large"],
|
64
|
-
control: { type: "multi-select" },
|
65
|
-
defaultValue: ["extra-padding"],
|
66
|
-
},
|
67
|
-
},
|
68
|
-
};
|
69
|
-
export const VerticalContentItemDuoList = {
|
70
|
-
name: "Vertical ContentItemDuo List",
|
71
|
-
render: ({ classModifier, items }) => (_jsx(List, { classModifier: classModifier.join(" "), children: items.map(({ classModifier: itemClassModifier, ...itemArgs }) => (_jsx(ContentItemDuo, { classModifier: itemClassModifier.join(" "), ...itemArgs }, itemArgs.id))) })),
|
72
|
-
args: {
|
73
|
-
items: Array.from({ length: 3 }, (_, i) => ({
|
74
|
-
id: i.toString(),
|
75
|
-
...verticalArgs,
|
76
|
-
})),
|
77
|
-
classModifier: ["extra-padding"],
|
78
|
-
},
|
79
|
-
argTypes: {
|
80
|
-
classModifier: {
|
81
|
-
options: ["extra-padding", "large"],
|
82
|
-
control: { type: "multi-select" },
|
83
|
-
defaultValue: ["extra-padding"],
|
84
|
-
},
|
85
|
-
},
|
86
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,40 +0,0 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import { render, screen, waitFor } from "@testing-library/react";
|
3
|
-
import userEvent from "@testing-library/user-event";
|
4
|
-
import { ContentItemDuo } from "../ContentItemDuo";
|
5
|
-
describe("ContentItemDuo", () => {
|
6
|
-
const label = "Sample Label";
|
7
|
-
const value = "Sample Value";
|
8
|
-
it("should render label and value correctly", () => {
|
9
|
-
render(_jsx(ContentItemDuo, { label: label, value: value }));
|
10
|
-
expect(screen.getByText(label)).toBeInTheDocument();
|
11
|
-
expect(screen.getByText(value)).toBeInTheDocument();
|
12
|
-
});
|
13
|
-
it("should render button with correct text and call onClick handler", async () => {
|
14
|
-
const buttonText = "button";
|
15
|
-
const onButtonClick = vi.fn();
|
16
|
-
render(_jsx(ContentItemDuo, { label: label, value: value, buttonText: buttonText, onButtonClick: onButtonClick }));
|
17
|
-
const buttonElement = screen.getByText(buttonText);
|
18
|
-
expect(buttonElement).toBeInTheDocument();
|
19
|
-
userEvent.click(buttonElement);
|
20
|
-
await waitFor(() => {
|
21
|
-
expect(onButtonClick).toHaveBeenCalled();
|
22
|
-
});
|
23
|
-
});
|
24
|
-
it("should render vertical layout when isVertical prop is true", () => {
|
25
|
-
render(_jsx(ContentItemDuo, { label: label, value: value, isVertical: true }));
|
26
|
-
expect(screen.getByText(label).parentElement).toHaveClass("af-content-item-duo--vertical");
|
27
|
-
});
|
28
|
-
it("should render done icon when isShowingDoneIcon prop is true", () => {
|
29
|
-
const { container } = render(_jsx(ContentItemDuo, { label: label, value: value, isShowingDoneIcon: true }));
|
30
|
-
const svgElement = container.querySelector("svg");
|
31
|
-
expect(svgElement).toBeInTheDocument();
|
32
|
-
expect(svgElement?.parentElement).toHaveClass("af-content-item-duo__icon--done");
|
33
|
-
});
|
34
|
-
it("should render close icon when isShowingCloseIcon prop is true", () => {
|
35
|
-
const { container } = render(_jsx(ContentItemDuo, { label: label, value: value, isShowingCloseIcon: true }));
|
36
|
-
const svgElement = container.querySelector("svg");
|
37
|
-
expect(svgElement).toBeInTheDocument();
|
38
|
-
expect(svgElement?.parentElement).toHaveClass("af-content-item-duo__icon--close");
|
39
|
-
});
|
40
|
-
});
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
2
|
-
import type { ComponentProps } from "react";
|
3
|
-
import { List } from "../List";
|
4
|
-
import { ContentItemMono } from "./ContentItemMono";
|
5
|
-
declare const meta: Meta<typeof ContentItemMono>;
|
6
|
-
export default meta;
|
7
|
-
export declare const Default: StoryObj<typeof ContentItemMono>;
|
8
|
-
export declare const ContentItemMonoWithIcon: StoryObj<typeof ContentItemMono>;
|
9
|
-
export declare const ContentItemMonoWithStick: StoryObj<typeof ContentItemMono>;
|
10
|
-
export declare const ContentItemMonoList: StoryObj<{
|
11
|
-
items: (ComponentProps<typeof ContentItemMono> & {
|
12
|
-
id: string;
|
13
|
-
})[];
|
14
|
-
} & Omit<ComponentProps<typeof List>, "classModifier"> & {
|
15
|
-
classModifier: string[];
|
16
|
-
}>;
|
@@ -1,99 +0,0 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import arrowForward from "@material-symbols/svg-400/rounded/arrow_forward.svg";
|
3
|
-
import { Svg } from "../../Svg";
|
4
|
-
import { List } from "../List";
|
5
|
-
import { ContentItemMono } from "./ContentItemMono";
|
6
|
-
import { ContentItemMonoSize } from "./constants";
|
7
|
-
const meta = {
|
8
|
-
title: "Components/List/ContentItemMono",
|
9
|
-
component: ContentItemMono,
|
10
|
-
};
|
11
|
-
export default meta;
|
12
|
-
const defaultArgs = {
|
13
|
-
children: "Texte principal",
|
14
|
-
secondaryText: "Texte secondaire",
|
15
|
-
tertiaryText: "Texte tertiaire",
|
16
|
-
size: ContentItemMonoSize.M,
|
17
|
-
isDisabled: false,
|
18
|
-
leftElement: "",
|
19
|
-
isLeftElementCentered: false,
|
20
|
-
hasStick: false,
|
21
|
-
classModifier: "",
|
22
|
-
};
|
23
|
-
const contentItemMonoWithIconArgs = {
|
24
|
-
children: "Texte principal",
|
25
|
-
secondaryText: "Texte secondaire",
|
26
|
-
tertiaryText: "Texte tertiaire",
|
27
|
-
size: ContentItemMonoSize.M,
|
28
|
-
isDisabled: false,
|
29
|
-
leftElement: _jsx(Svg, { src: arrowForward }),
|
30
|
-
isLeftElementCentered: true,
|
31
|
-
hasStick: false,
|
32
|
-
classModifier: "",
|
33
|
-
};
|
34
|
-
const contentItemMonoWithStickArgs = {
|
35
|
-
children: "Texte principal",
|
36
|
-
secondaryText: "Texte secondaire",
|
37
|
-
tertiaryText: "",
|
38
|
-
size: ContentItemMonoSize.M,
|
39
|
-
isDisabled: false,
|
40
|
-
leftElement: "",
|
41
|
-
isLeftElementCentered: false,
|
42
|
-
hasStick: true,
|
43
|
-
classModifier: "",
|
44
|
-
};
|
45
|
-
export const Default = {
|
46
|
-
name: "Default",
|
47
|
-
render: (args) => _jsx(ContentItemMono, { ...args }),
|
48
|
-
args: defaultArgs,
|
49
|
-
argTypes: {
|
50
|
-
size: {
|
51
|
-
options: Object.values(ContentItemMonoSize),
|
52
|
-
control: { type: "select" },
|
53
|
-
defaultValue: "m",
|
54
|
-
},
|
55
|
-
},
|
56
|
-
};
|
57
|
-
export const ContentItemMonoWithIcon = {
|
58
|
-
name: "ContentItemMono With Icon",
|
59
|
-
render: (args) => _jsx(ContentItemMono, { ...args }),
|
60
|
-
args: contentItemMonoWithIconArgs,
|
61
|
-
argTypes: {
|
62
|
-
size: {
|
63
|
-
options: Object.values(ContentItemMonoSize),
|
64
|
-
control: { type: "select" },
|
65
|
-
defaultValue: "m",
|
66
|
-
},
|
67
|
-
},
|
68
|
-
};
|
69
|
-
export const ContentItemMonoWithStick = {
|
70
|
-
name: "ContentItemMono With Stick",
|
71
|
-
render: (args) => _jsx(ContentItemMono, { ...args }),
|
72
|
-
args: contentItemMonoWithStickArgs,
|
73
|
-
argTypes: {
|
74
|
-
size: {
|
75
|
-
options: Object.values(ContentItemMonoSize),
|
76
|
-
control: { type: "select" },
|
77
|
-
defaultValue: "m",
|
78
|
-
},
|
79
|
-
},
|
80
|
-
};
|
81
|
-
export const ContentItemMonoList = {
|
82
|
-
name: "ContentItemMono List",
|
83
|
-
render: ({ items, classModifier, ...args }) => (_jsx(List, { classModifier: classModifier.join(" "), ...args, children: items.map((itemsArgs) => (_jsx(ContentItemMono, { ...itemsArgs }, itemsArgs.id))) })),
|
84
|
-
args: {
|
85
|
-
items: [
|
86
|
-
{ id: "1", ...defaultArgs },
|
87
|
-
{ id: "2", ...contentItemMonoWithIconArgs },
|
88
|
-
{ id: "3", ...contentItemMonoWithStickArgs },
|
89
|
-
],
|
90
|
-
classModifier: [],
|
91
|
-
},
|
92
|
-
argTypes: {
|
93
|
-
classModifier: {
|
94
|
-
options: ["large", "first-separator-full-width"],
|
95
|
-
control: { type: "multi-select" },
|
96
|
-
defaultValue: [],
|
97
|
-
},
|
98
|
-
},
|
99
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,45 +0,0 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import { render, screen } from "@testing-library/react";
|
3
|
-
import { ContentItemMono } from "../ContentItemMono";
|
4
|
-
import { ContentItemMonoSize } from "../constants";
|
5
|
-
describe("ContentItemMono", () => {
|
6
|
-
it("should render correctly", () => {
|
7
|
-
const children = "Content";
|
8
|
-
const secondaryText = "Secondary Text";
|
9
|
-
const tertiaryText = "Tertiary Text";
|
10
|
-
const leftElement = "Left Element";
|
11
|
-
render(_jsx(ContentItemMono, { secondaryText: secondaryText, tertiaryText: tertiaryText, leftElement: leftElement, hasStick: true, children: children }));
|
12
|
-
expect(screen.getByText(children)).toBeInTheDocument();
|
13
|
-
expect(screen.getByText(secondaryText)).toBeInTheDocument();
|
14
|
-
expect(screen.getByText(tertiaryText)).toBeInTheDocument();
|
15
|
-
expect(screen.getByText(leftElement)).toBeInTheDocument();
|
16
|
-
expect(screen.getByRole("presentation")).toBeInTheDocument();
|
17
|
-
});
|
18
|
-
it("should have custom class and M size", () => {
|
19
|
-
const className = "custom-class";
|
20
|
-
render(_jsx(ContentItemMono, { className: className, children: "Content" }));
|
21
|
-
expect(screen.getByText("Content").parentElement?.parentElement).toHaveClass(`${className} ${className}--m`);
|
22
|
-
});
|
23
|
-
it("should have XL size and no tertiary text", () => {
|
24
|
-
const className = "custom-class";
|
25
|
-
render(_jsx(ContentItemMono, { className: className, size: ContentItemMonoSize.XL, tertiaryText: "tertiaryText", children: "Content" }));
|
26
|
-
expect(screen.getByText("Content").parentElement?.parentElement).toHaveClass(`${className} ${className}--xl`);
|
27
|
-
expect(screen.queryByText("tertiaryText")).not.toBeInTheDocument();
|
28
|
-
});
|
29
|
-
it("should have custom class with modifier", () => {
|
30
|
-
const className = "custom-class";
|
31
|
-
const classModifier = "modifier";
|
32
|
-
render(_jsx(ContentItemMono, { className: className, classModifier: classModifier, children: "Content" }));
|
33
|
-
expect(screen.getByText("Content").parentElement?.parentElement).toHaveClass(`${className} ${className}--${classModifier}`);
|
34
|
-
});
|
35
|
-
it("should be disabled", () => {
|
36
|
-
const className = "custom-class";
|
37
|
-
render(_jsx(ContentItemMono, { className: className, isDisabled: true, children: "Content" }));
|
38
|
-
expect(screen.getByText("Content").parentElement?.parentElement).toHaveClass(`${className} ${className}--disabled`);
|
39
|
-
});
|
40
|
-
it("should have centered left element", () => {
|
41
|
-
const leftElement = "Left Element";
|
42
|
-
render(_jsx(ContentItemMono, { leftElement: leftElement, isLeftElementCentered: true, children: "Content" }));
|
43
|
-
expect(screen.getByText(leftElement)).toHaveClass("af-content-item-mono__left-container af-content-item-mono__left-container--center");
|
44
|
-
});
|
45
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|