@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,100 +0,0 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import download from "@material-symbols/svg-400/rounded/download_2-fill.svg";
|
3
|
-
import visibility from "@material-symbols/svg-400/rounded/visibility-fill.svg";
|
4
|
-
import { render, screen } from "@testing-library/react";
|
5
|
-
import userEvent from "@testing-library/user-event";
|
6
|
-
import { ContentTabItem } from "..";
|
7
|
-
import { ButtonVariants, Svg } from "../../../..";
|
8
|
-
describe("ContentTabList", () => {
|
9
|
-
const items = [
|
10
|
-
{
|
11
|
-
id: "1",
|
12
|
-
title: "Title 1",
|
13
|
-
subtitle: "Subtitle 1",
|
14
|
-
tag: "Tag 1",
|
15
|
-
date: "Date 1",
|
16
|
-
buttons: [
|
17
|
-
{
|
18
|
-
id: "download_button",
|
19
|
-
children: "Télécharger",
|
20
|
-
variant: ButtonVariants.ghost,
|
21
|
-
iconLeft: _jsx(Svg, { src: download, fill: "#00008F" }),
|
22
|
-
onClick: vi.fn(),
|
23
|
-
},
|
24
|
-
{
|
25
|
-
id: "display_button",
|
26
|
-
children: "Afficher",
|
27
|
-
variant: ButtonVariants.ghost,
|
28
|
-
iconLeft: _jsx(Svg, { src: visibility, fill: "#00008F" }),
|
29
|
-
onClick: vi.fn(),
|
30
|
-
},
|
31
|
-
],
|
32
|
-
},
|
33
|
-
{
|
34
|
-
id: "2",
|
35
|
-
title: "Title 2",
|
36
|
-
subtitle: "Subtitle 2",
|
37
|
-
tag: "Tag 2",
|
38
|
-
date: "Date 2",
|
39
|
-
value: "Value 2",
|
40
|
-
},
|
41
|
-
{
|
42
|
-
id: "3",
|
43
|
-
title: "Title 3",
|
44
|
-
value: "Value 3",
|
45
|
-
},
|
46
|
-
{
|
47
|
-
title: "Title 4",
|
48
|
-
date: "Date 4",
|
49
|
-
},
|
50
|
-
];
|
51
|
-
let originalWidth;
|
52
|
-
beforeEach(() => {
|
53
|
-
originalWidth = window.innerWidth;
|
54
|
-
});
|
55
|
-
afterEach(() => {
|
56
|
-
vi.stubGlobal("innerWidth", originalWidth);
|
57
|
-
});
|
58
|
-
it.each(items)("should render the items correctly", (item) => {
|
59
|
-
render(_jsx(ContentTabItem, { ...item }));
|
60
|
-
expect(screen.getByText(item.title)).toBeInTheDocument();
|
61
|
-
if (item.subtitle) {
|
62
|
-
expect(screen.getByText(item.subtitle)).toBeInTheDocument();
|
63
|
-
}
|
64
|
-
if (item.tag) {
|
65
|
-
expect(screen.getByText(item.tag)).toBeInTheDocument();
|
66
|
-
}
|
67
|
-
if (item.date) {
|
68
|
-
expect(screen.getByText(item.date)).toBeInTheDocument();
|
69
|
-
}
|
70
|
-
if (item.value) {
|
71
|
-
expect(screen.getByText(item.value)).toBeInTheDocument();
|
72
|
-
}
|
73
|
-
});
|
74
|
-
it.each(items)("should render the items correctly on mobile view", (item) => {
|
75
|
-
render(_jsx(ContentTabItem, { ...item, isMobile: true }));
|
76
|
-
expect(screen.getByText(item.title)).toBeInTheDocument();
|
77
|
-
if (item.subtitle) {
|
78
|
-
expect(screen.getByText(item.subtitle)).toBeInTheDocument();
|
79
|
-
}
|
80
|
-
if (item.tag) {
|
81
|
-
expect(screen.getByText(item.tag)).toBeInTheDocument();
|
82
|
-
}
|
83
|
-
if (item.date) {
|
84
|
-
expect(screen.getByText(item.date)).toBeInTheDocument();
|
85
|
-
}
|
86
|
-
if (item.value) {
|
87
|
-
expect(screen.getByText(item.value)).toBeInTheDocument();
|
88
|
-
}
|
89
|
-
});
|
90
|
-
it("should call onDownload when download button is clicked", async () => {
|
91
|
-
render(_jsx(ContentTabItem, { ...items[0] }));
|
92
|
-
await userEvent.click(screen.getByRole("button", { name: /Télécharger$/ }));
|
93
|
-
expect(items?.[0]?.buttons?.[0].onClick).toHaveBeenCalled();
|
94
|
-
});
|
95
|
-
it("should call onDisplay when display button is clicked", async () => {
|
96
|
-
render(_jsx(ContentTabItem, { ...items[0] }));
|
97
|
-
await userEvent.click(screen.getByRole("button", { name: /Afficher$/ }));
|
98
|
-
expect(items?.[0]?.buttons?.[1].onClick).toHaveBeenCalled();
|
99
|
-
});
|
100
|
-
});
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
2
|
-
import type { ComponentProps } from "react";
|
3
|
-
import { ContentTabList } from "./ContentTabList";
|
4
|
-
declare const meta: Meta<typeof ContentTabList>;
|
5
|
-
export default meta;
|
6
|
-
export declare const ContentTabListWithButtons: StoryObj<ComponentProps<typeof ContentTabList>>;
|
7
|
-
export declare const ContentTabListWithValue: StoryObj<ComponentProps<typeof ContentTabList>>;
|
@@ -1,78 +0,0 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import download from "@material-symbols/svg-400/rounded/download_2-fill.svg";
|
3
|
-
import visibility from "@material-symbols/svg-400/rounded/visibility-fill.svg";
|
4
|
-
import { ButtonVariants, Svg } from "../..";
|
5
|
-
import { ContentTabList } from "./ContentTabList";
|
6
|
-
const meta = {
|
7
|
-
title: "Components/List/ContentTabList",
|
8
|
-
component: ContentTabList,
|
9
|
-
};
|
10
|
-
export default meta;
|
11
|
-
const template = (args) => (_jsx(ContentTabList, { ...args }));
|
12
|
-
export const ContentTabListWithButtons = {
|
13
|
-
name: "ContentTabList with buttons",
|
14
|
-
render: template,
|
15
|
-
args: {
|
16
|
-
items: [
|
17
|
-
{
|
18
|
-
id: "1",
|
19
|
-
title: "Remboursement soins",
|
20
|
-
subtitle: "Titre onglet",
|
21
|
-
tag: "En attente",
|
22
|
-
date: "01/01/2024",
|
23
|
-
buttons: [
|
24
|
-
{
|
25
|
-
id: "download_button",
|
26
|
-
children: "Télécharger",
|
27
|
-
variant: ButtonVariants.ghost,
|
28
|
-
iconLeft: _jsx(Svg, { src: download }),
|
29
|
-
onClick: () => { },
|
30
|
-
},
|
31
|
-
],
|
32
|
-
},
|
33
|
-
{
|
34
|
-
id: "2",
|
35
|
-
title: "Remboursement soins",
|
36
|
-
tag: "En attente",
|
37
|
-
buttons: [
|
38
|
-
{
|
39
|
-
id: "download_button",
|
40
|
-
children: "Télécharger",
|
41
|
-
variant: ButtonVariants.ghost,
|
42
|
-
iconLeft: _jsx(Svg, { src: download }),
|
43
|
-
onClick: () => { },
|
44
|
-
},
|
45
|
-
{
|
46
|
-
id: "display_button",
|
47
|
-
children: "Afficher",
|
48
|
-
variant: ButtonVariants.ghost,
|
49
|
-
iconLeft: _jsx(Svg, { src: visibility }),
|
50
|
-
onClick: () => { },
|
51
|
-
},
|
52
|
-
],
|
53
|
-
},
|
54
|
-
],
|
55
|
-
classModifier: "",
|
56
|
-
},
|
57
|
-
};
|
58
|
-
export const ContentTabListWithValue = {
|
59
|
-
name: "ContentTabList with value",
|
60
|
-
render: template,
|
61
|
-
args: {
|
62
|
-
items: [
|
63
|
-
{
|
64
|
-
id: "1",
|
65
|
-
title: "Remboursement soins",
|
66
|
-
subtitle: "Titre onglet",
|
67
|
-
date: "01/01/2024",
|
68
|
-
value: "+ 11,86 €",
|
69
|
-
},
|
70
|
-
{
|
71
|
-
id: "2",
|
72
|
-
title: "Remboursement soins",
|
73
|
-
tag: "En attente",
|
74
|
-
value: "+ 11,86 €",
|
75
|
-
},
|
76
|
-
],
|
77
|
-
},
|
78
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,57 +0,0 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import download from "@material-symbols/svg-400/rounded/download_2-fill.svg";
|
3
|
-
import visibility from "@material-symbols/svg-400/rounded/visibility-fill.svg";
|
4
|
-
import { render, screen } from "@testing-library/react";
|
5
|
-
import { ButtonVariants, Svg } from "../../..";
|
6
|
-
import { ContentTabList } from "../ContentTabList";
|
7
|
-
describe("ContentTabList", () => {
|
8
|
-
const items = [
|
9
|
-
{
|
10
|
-
id: "1",
|
11
|
-
title: "Title 1",
|
12
|
-
subtitle: "Subtitle 1",
|
13
|
-
tag: "Tag 1",
|
14
|
-
date: "Date 1",
|
15
|
-
buttons: [
|
16
|
-
{
|
17
|
-
id: "download_button",
|
18
|
-
children: "Télécharger",
|
19
|
-
variant: ButtonVariants.ghost,
|
20
|
-
iconLeft: _jsx(Svg, { src: download, fill: "#00008F" }),
|
21
|
-
onClick: vi.fn(),
|
22
|
-
},
|
23
|
-
{
|
24
|
-
id: "display_button",
|
25
|
-
children: "Afficher",
|
26
|
-
variant: ButtonVariants.ghost,
|
27
|
-
iconLeft: _jsx(Svg, { src: visibility, fill: "#00008F" }),
|
28
|
-
onClick: vi.fn(),
|
29
|
-
},
|
30
|
-
],
|
31
|
-
},
|
32
|
-
{
|
33
|
-
id: "2",
|
34
|
-
title: "Title 2",
|
35
|
-
subtitle: "Subtitle 2",
|
36
|
-
tag: "Tag 2",
|
37
|
-
date: "Date 2",
|
38
|
-
value: "Value 2",
|
39
|
-
},
|
40
|
-
{
|
41
|
-
id: "3",
|
42
|
-
title: "Title 3",
|
43
|
-
value: "Value 3",
|
44
|
-
},
|
45
|
-
{
|
46
|
-
title: "Title 4",
|
47
|
-
date: "Date 4",
|
48
|
-
},
|
49
|
-
];
|
50
|
-
it("should render the list correctly", () => {
|
51
|
-
render(_jsx(ContentTabList, { items: items }));
|
52
|
-
expect(screen.getByText("Title 1")).toBeInTheDocument();
|
53
|
-
expect(screen.getByText("Title 2")).toBeInTheDocument();
|
54
|
-
expect(screen.getByText("Title 3")).toBeInTheDocument();
|
55
|
-
expect(screen.getByText("Title 4")).toBeInTheDocument();
|
56
|
-
});
|
57
|
-
});
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react";
|
2
|
-
import type { ComponentProps } from "react";
|
3
|
-
import { List } from "./List";
|
4
|
-
declare const meta: Meta<typeof List>;
|
5
|
-
export default meta;
|
6
|
-
export declare const Default: StoryObj<Omit<ComponentProps<typeof List>, "classModifier"> & {
|
7
|
-
classModifier: string[];
|
8
|
-
}>;
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import trashIcon from "@material-symbols/svg-400/outlined/delete.svg";
|
3
|
-
import publishedWithChangesIcon from "@material-symbols/svg-400/outlined/published_with_changes-fill.svg";
|
4
|
-
import { Svg } from "../Svg";
|
5
|
-
import { ClickItem } from "./ClickList";
|
6
|
-
import { ContentItemMono } from "./ContentItemMono";
|
7
|
-
import { List } from "./List";
|
8
|
-
const meta = {
|
9
|
-
title: "Components/List",
|
10
|
-
component: List,
|
11
|
-
};
|
12
|
-
export default meta;
|
13
|
-
export const Default = {
|
14
|
-
name: "List",
|
15
|
-
render: ({ classModifier, ...args }) => (_jsx(List, { classModifier: classModifier.join(" "), ...args })),
|
16
|
-
args: {
|
17
|
-
children: [
|
18
|
-
_jsx(ContentItemMono, { secondaryText: "nom.pr\u00E9nom@mail.fr", children: "Pr\u00E9nom NOM" }, 0),
|
19
|
-
_jsx(ClickItem, { icon: _jsx(Svg, { src: publishedWithChangesIcon }), children: "Modifier le profil" }, 1),
|
20
|
-
_jsx(ClickItem, { icon: _jsx(Svg, { src: trashIcon }), children: "Supprimer le profil" }, 2),
|
21
|
-
],
|
22
|
-
classModifier: ["first-separator-full-width"],
|
23
|
-
},
|
24
|
-
argTypes: {
|
25
|
-
classModifier: {
|
26
|
-
options: ["large", "extra-padding", "first-separator-full-width"],
|
27
|
-
control: { type: "multi-select" },
|
28
|
-
defaultValue: [],
|
29
|
-
},
|
30
|
-
},
|
31
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,30 +0,0 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import { render, screen } from "@testing-library/react";
|
3
|
-
import { List } from "../List";
|
4
|
-
describe("List", () => {
|
5
|
-
it("should render children", () => {
|
6
|
-
const children = _jsx("div", { children: "Child 1" });
|
7
|
-
render(_jsx(List, { children: children }));
|
8
|
-
expect(screen.getByRole("list")).toHaveClass("af-list");
|
9
|
-
expect(screen.getByText("Child 1")).toBeInTheDocument();
|
10
|
-
expect(screen.queryByRole("separator")).toBeNull();
|
11
|
-
});
|
12
|
-
it("should render with empty children", () => {
|
13
|
-
const children = undefined;
|
14
|
-
render(_jsx(List, { children: children }));
|
15
|
-
expect(screen.getByRole("list")).toHaveClass("af-list");
|
16
|
-
expect(screen.queryByRole("separator")).toBeNull();
|
17
|
-
});
|
18
|
-
it("should render multiple children with separators", () => {
|
19
|
-
const children = [
|
20
|
-
_jsx("div", { children: "Child 1" }, "1"),
|
21
|
-
_jsx("div", { children: "Child 2" }, "2"),
|
22
|
-
_jsx("div", { children: "Child 3" }, "3"),
|
23
|
-
];
|
24
|
-
render(_jsx(List, { children: children }));
|
25
|
-
expect(screen.getByText("Child 1")).toBeInTheDocument();
|
26
|
-
expect(screen.getByText("Child 2")).toBeInTheDocument();
|
27
|
-
expect(screen.getByText("Child 3")).toBeInTheDocument();
|
28
|
-
expect(screen.getAllByRole("separator")).toHaveLength(2);
|
29
|
-
});
|
30
|
-
});
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import { Loader } from "./Loader";
|
3
|
-
const meta = {
|
4
|
-
component: Loader,
|
5
|
-
title: "Components/Loader",
|
6
|
-
};
|
7
|
-
export default meta;
|
8
|
-
export const LoaderStory = {
|
9
|
-
name: "Loader",
|
10
|
-
render: ({ ...args }) => _jsx(Loader, { ...args }),
|
11
|
-
args: {
|
12
|
-
size: 60,
|
13
|
-
border: 5,
|
14
|
-
},
|
15
|
-
};
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react";
|
2
|
-
import { Modal } from "./Modal";
|
3
|
-
declare const meta: Meta<typeof Modal>;
|
4
|
-
export default meta;
|
5
|
-
type StoryProps = React.ComponentProps<typeof Modal>;
|
6
|
-
type Story = StoryObj<StoryProps>;
|
7
|
-
export declare const Playground: Story;
|
@@ -1,37 +0,0 @@
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import { useState } from "react";
|
3
|
-
import bluetoothAudio from "@material-symbols/svg-400/outlined/bluetooth_searching.svg";
|
4
|
-
import { Modal } from "./Modal";
|
5
|
-
import { Svg } from "../Svg";
|
6
|
-
const meta = {
|
7
|
-
title: "Components/Modal",
|
8
|
-
component: Modal,
|
9
|
-
parameters: {
|
10
|
-
layout: "centered",
|
11
|
-
},
|
12
|
-
};
|
13
|
-
export default meta;
|
14
|
-
const Container = (props) => {
|
15
|
-
const [isOpen, setIsOpen] = useState(false);
|
16
|
-
return (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", onClick: () => setIsOpen(true), children: "open modal" }), _jsx(Modal, { ...props, isOpen: isOpen, onClose: () => setIsOpen(false), onClickOutside: undefined, actions: {
|
17
|
-
primary: { text: "Save", callback: () => setIsOpen(false) },
|
18
|
-
secondary: { text: "Cancel", callback: () => setIsOpen(false) },
|
19
|
-
tertiary: {
|
20
|
-
text: "Reset",
|
21
|
-
callback: () => setIsOpen(false),
|
22
|
-
disabled: true,
|
23
|
-
},
|
24
|
-
} })] }));
|
25
|
-
};
|
26
|
-
export const Playground = {
|
27
|
-
name: "Modal",
|
28
|
-
render: (args) => _jsx(Container, { ...args }),
|
29
|
-
args: {
|
30
|
-
hasCloseBtn: true,
|
31
|
-
title: "Modal title",
|
32
|
-
children: "Vestibulum nunc neque, sodales non luctus in, dictum vitae nisl. Curabitur vitae massa non nisl lacinia tempus. Pellentesque id nulla tortor.",
|
33
|
-
iconTitle: _jsx(Svg, { src: bluetoothAudio }),
|
34
|
-
subtitle: "Info complémentaire",
|
35
|
-
fullWidthButtons: false,
|
36
|
-
},
|
37
|
-
};
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
2
|
-
import { Pagination } from "./Pagination";
|
3
|
-
declare const meta: Meta<typeof Pagination>;
|
4
|
-
export default meta;
|
5
|
-
type StoryProps = Omit<React.ComponentProps<typeof Pagination>, "numberPage"> & {
|
6
|
-
numberPage: number;
|
7
|
-
onChangePage: (page: number) => void;
|
8
|
-
defaultPage?: number;
|
9
|
-
};
|
10
|
-
type Story = StoryObj<StoryProps>;
|
11
|
-
export declare const Playground: Story;
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import { Pagination } from "./Pagination";
|
3
|
-
const meta = {
|
4
|
-
component: Pagination,
|
5
|
-
title: "Components/Pagination",
|
6
|
-
parameters: {
|
7
|
-
layout: "centered",
|
8
|
-
},
|
9
|
-
};
|
10
|
-
export default meta;
|
11
|
-
export const Playground = {
|
12
|
-
name: "Pagination",
|
13
|
-
render: ({ numberPage, onChangePage, defaultPage }) => (_jsx(Pagination, { numberPage: numberPage, defaultPage: defaultPage, onChangePage: onChangePage })),
|
14
|
-
args: {
|
15
|
-
numberPage: 20,
|
16
|
-
defaultPage: 2,
|
17
|
-
onChangePage: () => { },
|
18
|
-
},
|
19
|
-
};
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
2
|
-
import { ComponentProps } from "react";
|
3
|
-
import { Stepper } from "./Stepper";
|
4
|
-
declare const meta: Meta<typeof Stepper>;
|
5
|
-
export default meta;
|
6
|
-
type StoryProps = Omit<ComponentProps<typeof Stepper>, "currentStep" | "currentStepProgress" | "isTitleVisible" | "isSubtitleVisible" | "currentTitle" | "nbSteps"> & {
|
7
|
-
currentStep: number;
|
8
|
-
currentSubtitle: string;
|
9
|
-
currentStepProgress: number;
|
10
|
-
isTitleVisible: boolean;
|
11
|
-
isSubtitleVisible: boolean;
|
12
|
-
currentTitle: string;
|
13
|
-
nbSteps: 2 | 3 | 4 | 5 | 6;
|
14
|
-
};
|
15
|
-
type Story = StoryObj<StoryProps>;
|
16
|
-
export declare const Playground: Story;
|
@@ -1,23 +0,0 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import { Stepper } from "./Stepper";
|
3
|
-
const meta = {
|
4
|
-
component: Stepper,
|
5
|
-
title: "Components/Stepper",
|
6
|
-
parameters: {
|
7
|
-
layout: "centered",
|
8
|
-
},
|
9
|
-
};
|
10
|
-
export default meta;
|
11
|
-
export const Playground = {
|
12
|
-
name: "Stepper",
|
13
|
-
render: (props) => (_jsx("div", { style: { minWidth: "70vw" }, children: _jsx(Stepper, { ...props }) })),
|
14
|
-
args: {
|
15
|
-
nbSteps: 3,
|
16
|
-
currentTitle: "Step title",
|
17
|
-
currentStep: 2,
|
18
|
-
currentSubtitle: "Step subtitle",
|
19
|
-
currentStepProgress: 50,
|
20
|
-
isTitleVisible: true,
|
21
|
-
isSubtitleVisible: true,
|
22
|
-
},
|
23
|
-
};
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
2
|
-
import "./Svg.stories.css";
|
3
|
-
import { Svg } from ".";
|
4
|
-
declare const meta: Meta;
|
5
|
-
export default meta;
|
6
|
-
export declare const Default: StoryObj<typeof Svg>;
|
7
|
-
export declare const Headphones: StoryObj<typeof Svg>;
|
package/dist/Svg/Svg.stories.js
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import headphonesIcons from "@material-symbols/svg-400/outlined/headphones.svg";
|
3
|
-
import homeIcons from "@material-symbols/svg-400/outlined/home.svg";
|
4
|
-
import saveIcons from "@material-symbols/svg-400/outlined/save.svg";
|
5
|
-
import closeIcons from "@material-symbols/svg-400/outlined/close.svg";
|
6
|
-
import "./Svg.stories.css";
|
7
|
-
import { Svg } from ".";
|
8
|
-
const meta = {
|
9
|
-
title: "Components/Svg",
|
10
|
-
component: Svg,
|
11
|
-
};
|
12
|
-
export default meta;
|
13
|
-
const MODIFIERS = {
|
14
|
-
"/public/headphones.svg": headphonesIcons,
|
15
|
-
"/public/home.svg": homeIcons,
|
16
|
-
"/public/save.svg": saveIcons,
|
17
|
-
"/public/close.svg": closeIcons,
|
18
|
-
"simulate svg error": "foo",
|
19
|
-
};
|
20
|
-
export const Default = {
|
21
|
-
name: "Svg",
|
22
|
-
render: ({ src, ...args }) => _jsx(Svg, { src: MODIFIERS[src], ...args }),
|
23
|
-
args: {
|
24
|
-
src: "/public/headphones.svg",
|
25
|
-
fill: "#00008f",
|
26
|
-
width: 24,
|
27
|
-
height: 24,
|
28
|
-
alt: "error",
|
29
|
-
},
|
30
|
-
argTypes: {
|
31
|
-
src: {
|
32
|
-
options: Object.keys(MODIFIERS),
|
33
|
-
control: { type: "select" },
|
34
|
-
},
|
35
|
-
},
|
36
|
-
};
|
37
|
-
export const Headphones = {
|
38
|
-
name: "Svg Headphones",
|
39
|
-
render: () => _jsx(Svg, { src: headphonesIcons, fill: "#00008f" }),
|
40
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,38 +0,0 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import { render, screen } from "@testing-library/react";
|
3
|
-
import { axe } from "jest-axe";
|
4
|
-
import { Svg } from "../Svg";
|
5
|
-
const mocks = vi.hoisted(() => {
|
6
|
-
return {
|
7
|
-
SVGInjector: vi.fn(),
|
8
|
-
};
|
9
|
-
});
|
10
|
-
vi.mock("@tanem/svg-injector", () => mocks);
|
11
|
-
describe("<Svg />", () => {
|
12
|
-
describe("render", () => {
|
13
|
-
it("renders correctly", () => {
|
14
|
-
mocks.SVGInjector.mockImplementationOnce((el, { afterEach }) => {
|
15
|
-
afterEach(undefined, el);
|
16
|
-
});
|
17
|
-
const svgSrc = "svgSrc";
|
18
|
-
render(_jsx(Svg, { src: "svgSrc", alt: "foo", "aria-label": "test" }));
|
19
|
-
const svg = screen.getByLabelText("test");
|
20
|
-
expect(svg).toBeInTheDocument();
|
21
|
-
expect(svg).toHaveAttribute("data-src", svgSrc);
|
22
|
-
});
|
23
|
-
it("renders fallback when src not found", async () => {
|
24
|
-
mocks.SVGInjector.mockImplementationOnce((_, { afterEach }) => {
|
25
|
-
afterEach("error");
|
26
|
-
});
|
27
|
-
render(_jsx(Svg, { src: "fake", alt: "foo", "aria-label": "test" }));
|
28
|
-
const svg = screen.getByText("foo");
|
29
|
-
expect(svg).toBeInTheDocument();
|
30
|
-
});
|
31
|
-
});
|
32
|
-
describe("A11Y", () => {
|
33
|
-
it("shouldn't have an accessibility violation <Svg />", async () => {
|
34
|
-
const { container } = render(_jsx(Svg, { src: "svgSrc", alt: "foo" }));
|
35
|
-
expect(await axe(container)).toHaveNoViolations();
|
36
|
-
});
|
37
|
-
});
|
38
|
-
});
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react";
|
2
|
-
import { ReactNode } from "react";
|
3
|
-
import { Direction, TabsClient } from "./Tabs";
|
4
|
-
declare const meta: Meta<typeof TabsClient>;
|
5
|
-
export default meta;
|
6
|
-
type StoryProps = Omit<React.ComponentProps<typeof TabsClient>, "items" | "direction" | "preSelectedTabIndex"> & {
|
7
|
-
items: {
|
8
|
-
title: string;
|
9
|
-
content: string | ReactNode;
|
10
|
-
icon?: ReactNode;
|
11
|
-
}[];
|
12
|
-
preSelectedTabIndex?: number;
|
13
|
-
direction?: Direction;
|
14
|
-
};
|
15
|
-
export declare const TabsStory: StoryObj<StoryProps>;
|
16
|
-
export declare const TabsCenterDirectionStory: StoryObj<StoryProps>;
|
17
|
-
export declare const TabsWithReactNodeStory: StoryObj<typeof TabsClient>;
|
@@ -1,89 +0,0 @@
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import accessTime from "@material-symbols/svg-400/outlined/schedule.svg";
|
3
|
-
import bluetoothAudio from "@material-symbols/svg-400/outlined/bluetooth_searching.svg";
|
4
|
-
import { Direction, TabsClient } from "./Tabs";
|
5
|
-
import { Svg } from "../Svg";
|
6
|
-
const meta = {
|
7
|
-
component: TabsClient,
|
8
|
-
title: "Components/Tabs",
|
9
|
-
parameters: {
|
10
|
-
layout: "fullscreen",
|
11
|
-
},
|
12
|
-
};
|
13
|
-
export default meta;
|
14
|
-
export const TabsStory = {
|
15
|
-
name: "Tabs",
|
16
|
-
render: ({ items, preSelectedTabIndex, direction }) => {
|
17
|
-
const props = {
|
18
|
-
items,
|
19
|
-
preSelectedTabIndex,
|
20
|
-
};
|
21
|
-
if (direction === Direction.center) {
|
22
|
-
props.direction = Direction.center;
|
23
|
-
}
|
24
|
-
return _jsx(TabsClient, { ...props });
|
25
|
-
},
|
26
|
-
args: {
|
27
|
-
items: [
|
28
|
-
{ title: "Tab 1", content: "Content 1" },
|
29
|
-
{ title: "Tab 2", content: "Content 2", icon: _jsx(Svg, { src: accessTime }) },
|
30
|
-
{ title: "Tab 3", content: "Content 3" },
|
31
|
-
],
|
32
|
-
preSelectedTabIndex: 0,
|
33
|
-
},
|
34
|
-
argTypes: {
|
35
|
-
items: {
|
36
|
-
control: { type: "object" },
|
37
|
-
},
|
38
|
-
preSelectedTabIndex: {
|
39
|
-
control: { type: "number" },
|
40
|
-
},
|
41
|
-
direction: {
|
42
|
-
control: "select",
|
43
|
-
options: ["default", "center"],
|
44
|
-
},
|
45
|
-
},
|
46
|
-
};
|
47
|
-
export const TabsCenterDirectionStory = {
|
48
|
-
name: "TabsCenterDirection",
|
49
|
-
render: (args) => _jsx(TabsClient, { ...args }),
|
50
|
-
args: {
|
51
|
-
items: [
|
52
|
-
{ title: "Center tab 1", content: "Content 1" },
|
53
|
-
{
|
54
|
-
title: "Center tab 2",
|
55
|
-
content: "Content 2",
|
56
|
-
icon: _jsx(Svg, { src: accessTime }),
|
57
|
-
},
|
58
|
-
{
|
59
|
-
title: "Center tab 3",
|
60
|
-
content: "Content 3",
|
61
|
-
icon: _jsx(Svg, { src: bluetoothAudio }),
|
62
|
-
},
|
63
|
-
],
|
64
|
-
preSelectedTabIndex: 0,
|
65
|
-
direction: Direction.center,
|
66
|
-
},
|
67
|
-
};
|
68
|
-
export const TabsWithReactNodeStory = {
|
69
|
-
name: "TabsWithReactNode",
|
70
|
-
render: (args) => _jsx(TabsClient, { ...args }),
|
71
|
-
args: {
|
72
|
-
items: [
|
73
|
-
{
|
74
|
-
title: "ReactNode tab 1",
|
75
|
-
content: (_jsxs(_Fragment, { children: [_jsx("h2", { children: "Titre 1" }), _jsx("p", { children: "Content 1" })] })),
|
76
|
-
},
|
77
|
-
{
|
78
|
-
title: "ReactNode tab 2",
|
79
|
-
content: (_jsxs(_Fragment, { children: [_jsx("h2", { children: "Titre 2" }), _jsx("p", { children: "Content 2" })] })),
|
80
|
-
},
|
81
|
-
{
|
82
|
-
title: "ReactNode tab 3",
|
83
|
-
content: (_jsxs(_Fragment, { children: [_jsx("h2", { children: "Titre 3" }), _jsx("p", { children: "Content 3" })] })),
|
84
|
-
},
|
85
|
-
],
|
86
|
-
direction: Direction.center,
|
87
|
-
preSelectedTabIndex: 0,
|
88
|
-
},
|
89
|
-
};
|