@axa-fr/design-system-look-and-feel-react 0.2.0-beta.339 → 0.2.0-beta.352

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.
Files changed (99) hide show
  1. package/package.json +21 -17
  2. package/dist/Accordion/Accordion.stories.d.ts +0 -7
  3. package/dist/Accordion/Accordion.stories.js +0 -40
  4. package/dist/Accordion/__tests__/Accordion.test.d.ts +0 -1
  5. package/dist/Accordion/__tests__/Accordion.test.js +0 -50
  6. package/dist/Accordion/__tests__/AccordionTagDateContainer.test.d.ts +0 -1
  7. package/dist/Accordion/__tests__/AccordionTagDateContainer.test.js +0 -23
  8. package/dist/AccordionCore/AccordionCore.stories.d.ts +0 -8
  9. package/dist/AccordionCore/AccordionCore.stories.js +0 -41
  10. package/dist/AccordionCore/__tests__/AccordionCore.test.d.ts +0 -1
  11. package/dist/AccordionCore/__tests__/AccordionCore.test.js +0 -47
  12. package/dist/Alert/Alert.stories.d.ts +0 -6
  13. package/dist/Alert/Alert.stories.js +0 -37
  14. package/dist/Alert/__tests__/Alert.test.d.ts +0 -1
  15. package/dist/Alert/__tests__/Alert.test.js +0 -33
  16. package/dist/Button/Button.stories.d.ts +0 -22
  17. package/dist/Button/Button.stories.js +0 -99
  18. package/dist/Card/Card.stories.d.ts +0 -6
  19. package/dist/Card/Card.stories.js +0 -40
  20. package/dist/Card/__tests__/Card.test.d.ts +0 -1
  21. package/dist/Card/__tests__/Card.test.js +0 -27
  22. package/dist/Form/Checkbox/Checkbox.stories.d.ts +0 -6
  23. package/dist/Form/Checkbox/Checkbox.stories.js +0 -38
  24. package/dist/Form/Checkbox/CheckboxSelect.stories.d.ts +0 -6
  25. package/dist/Form/Checkbox/CheckboxSelect.stories.js +0 -55
  26. package/dist/Form/FileUpload/FIleUpload.stories.d.ts +0 -6
  27. package/dist/Form/FileUpload/FIleUpload.stories.js +0 -54
  28. package/dist/Form/InputError/InputError.stories.d.ts +0 -5
  29. package/dist/Form/InputError/InputError.stories.js +0 -12
  30. package/dist/Form/Radio/Radio.stories.d.ts +0 -6
  31. package/dist/Form/Radio/Radio.stories.js +0 -38
  32. package/dist/Form/Radio/RadioSelect.stories.d.ts +0 -8
  33. package/dist/Form/Radio/RadioSelect.stories.js +0 -112
  34. package/dist/Form/Select/Select.stories.d.ts +0 -10
  35. package/dist/Form/Select/Select.stories.js +0 -31
  36. package/dist/Form/Text/Text.stories.d.ts +0 -9
  37. package/dist/Form/Text/Text.stories.js +0 -51
  38. package/dist/IconBg/IconBg.stories.d.ts +0 -5
  39. package/dist/IconBg/IconBg.stories.js +0 -23
  40. package/dist/IconBg/__tests__/IconBg.test.d.ts +0 -1
  41. package/dist/IconBg/__tests__/IconBg.test.js +0 -22
  42. package/dist/Layout/Footer/Footer.stories.d.ts +0 -14
  43. package/dist/Layout/Footer/Footer.stories.js +0 -48
  44. package/dist/Layout/Header/Header.stories.d.ts +0 -10
  45. package/dist/Layout/Header/Header.stories.js +0 -52
  46. package/dist/Layout/Header/NavBar/NavBar.stories.d.ts +0 -8
  47. package/dist/Layout/Header/NavBar/NavBar.stories.js +0 -17
  48. package/dist/Layout/Header/PreviousLink/PreviousLink.stories.d.ts +0 -8
  49. package/dist/Layout/Header/PreviousLink/PreviousLink.stories.js +0 -16
  50. package/dist/Link/Link.stories.d.ts +0 -5
  51. package/dist/Link/Link.stories.js +0 -14
  52. package/dist/List/ClickList/ClickItem/__tests__/ClickItem.test.d.ts +0 -1
  53. package/dist/List/ClickList/ClickItem/__tests__/ClickItem.test.js +0 -62
  54. package/dist/List/ClickList/ClickList.stories.d.ts +0 -7
  55. package/dist/List/ClickList/ClickList.stories.js +0 -103
  56. package/dist/List/ClickList/__tests__/ClickList.client.test.d.ts +0 -1
  57. package/dist/List/ClickList/__tests__/ClickList.client.test.js +0 -18
  58. package/dist/List/ContentItemDuo/ContentItemDuo.stories.d.ts +0 -28
  59. package/dist/List/ContentItemDuo/ContentItemDuo.stories.js +0 -86
  60. package/dist/List/ContentItemDuo/__tests__/ContentItemDuo.test.d.ts +0 -1
  61. package/dist/List/ContentItemDuo/__tests__/ContentItemDuo.test.js +0 -40
  62. package/dist/List/ContentItemMono/ContentItemMono.stories.d.ts +0 -16
  63. package/dist/List/ContentItemMono/ContentItemMono.stories.js +0 -99
  64. package/dist/List/ContentItemMono/__tests__/ContentItemMono.test.d.ts +0 -1
  65. package/dist/List/ContentItemMono/__tests__/ContentItemMono.test.js +0 -45
  66. package/dist/List/ContentTabList/ContentTabItem/__tests__/ContentTabItem.test.d.ts +0 -1
  67. package/dist/List/ContentTabList/ContentTabItem/__tests__/ContentTabItem.test.js +0 -100
  68. package/dist/List/ContentTabList/ContentTabList.stories.d.ts +0 -7
  69. package/dist/List/ContentTabList/ContentTabList.stories.js +0 -78
  70. package/dist/List/ContentTabList/__tests__/ContentTabList.test.d.ts +0 -1
  71. package/dist/List/ContentTabList/__tests__/ContentTabList.test.js +0 -57
  72. package/dist/List/List.stories.d.ts +0 -8
  73. package/dist/List/List.stories.js +0 -31
  74. package/dist/List/__tests__/List.test.d.ts +0 -1
  75. package/dist/List/__tests__/List.test.js +0 -30
  76. package/dist/Loader/Loader.stories.d.ts +0 -6
  77. package/dist/Loader/Loader.stories.js +0 -15
  78. package/dist/ModalClient/Modal.stories.d.ts +0 -7
  79. package/dist/ModalClient/Modal.stories.js +0 -37
  80. package/dist/Pagination/Pagination.stories.d.ts +0 -11
  81. package/dist/Pagination/Pagination.stories.js +0 -19
  82. package/dist/Stepper/Stepper.stories.d.ts +0 -16
  83. package/dist/Stepper/Stepper.stories.js +0 -23
  84. package/dist/Svg/Svg.stories.d.ts +0 -7
  85. package/dist/Svg/Svg.stories.js +0 -40
  86. package/dist/Svg/__tests__/Svg.test.d.ts +0 -1
  87. package/dist/Svg/__tests__/Svg.test.js +0 -38
  88. package/dist/Tabs/Tabs.stories.d.ts +0 -17
  89. package/dist/Tabs/Tabs.stories.js +0 -89
  90. package/dist/Tag/Tag.stories.d.ts +0 -5
  91. package/dist/Tag/Tag.stories.js +0 -22
  92. package/dist/Tag/__test__/Tag.test.d.ts +0 -1
  93. package/dist/Tag/__test__/Tag.test.js +0 -18
  94. package/dist/Title/Title.stories.d.ts +0 -6
  95. package/dist/Title/Title.stories.js +0 -45
  96. package/dist/Title/__tests__/Title.test.d.ts +0 -1
  97. package/dist/Title/__tests__/Title.test.js +0 -28
  98. package/dist/Title/__tests__/TitleWithSubtitles.test.d.ts +0 -1
  99. package/dist/Title/__tests__/TitleWithSubtitles.test.js +0 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/design-system-look-and-feel-react",
3
- "version": "0.2.0-beta.339",
3
+ "version": "0.2.0-beta.352",
4
4
  "description": "",
5
5
  "exports": {
6
6
  ".": {
@@ -17,14 +17,14 @@
17
17
  ],
18
18
  "scripts": {
19
19
  "prebuild": "rimraf dist",
20
- "build": "tsc",
20
+ "build": "tsc -p tsconfig.build.json",
21
21
  "postbuild": "copyfiles --up 1 \"src/assets/svg/*.svg\" ./dist/",
22
22
  "start:storybook": "storybook dev -p 6009",
23
23
  "build:storybook": "storybook build",
24
24
  "eslint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
25
25
  "eslint:fix": "eslint src --ext js,jsx,ts,tsx --fix",
26
- "prettier": "prettier \"src/**/*.!(js|jsx|ts|tsx)\" --check",
27
- "prettier:fix": "prettier \"src/**/*.!(js|jsx|ts|tsx)\" --write",
26
+ "prettier": "prettier \"src/**/*.!(js|jsx|ts|tsx|svg)\" --check",
27
+ "prettier:fix": "prettier \"src/**/*.!(js|jsx|ts|tsx|svg)\" --write",
28
28
  "tsc": "tsc --noEmit",
29
29
  "test": "vitest",
30
30
  "test:ui": "vitest --ui",
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "homepage": "https://github.com/AxaFrance/design-system#readme",
43
43
  "peerDependencies": {
44
- "@axa-fr/design-system-look-and-feel-css": "0.2.0-beta.339",
44
+ "@axa-fr/design-system-look-and-feel-css": "0.2.0-beta.352",
45
45
  "@material-symbols/svg-400": ">= 0.19.0",
46
46
  "react": ">= 18"
47
47
  },
@@ -59,18 +59,21 @@
59
59
  "react-select": "^5.8.0"
60
60
  },
61
61
  "devDependencies": {
62
+ "@chromatic-com/storybook": "^1.9.0",
62
63
  "@material-symbols/svg-400": "*",
63
- "@storybook/addon-docs": "^7.6.14",
64
- "@storybook/addon-essentials": "^7.6.14",
65
- "@storybook/addon-interactions": "^7.6.14",
66
- "@storybook/addon-links": "^7.6.14",
67
- "@storybook/addon-mdx-gfm": "^7.6.14",
68
- "@storybook/addon-onboarding": "^1.0.10",
69
- "@storybook/addons": "^7.6.14",
70
- "@storybook/blocks": "^7.6.14",
71
- "@storybook/react": "^7.6.14",
72
- "@storybook/react-vite": "^7.6.14",
73
- "@storybook/test": "^7.6.14",
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",
74
77
  "@testing-library/dom": "^10.1.0",
75
78
  "@testing-library/jest-dom": "^6.5.0",
76
79
  "@testing-library/react": "^15.0.7",
@@ -95,6 +98,7 @@
95
98
  "eslint-plugin-prettier": "^5.1.3",
96
99
  "eslint-plugin-react": "^7.36.1",
97
100
  "eslint-plugin-react-hooks": "^4.6.0",
101
+ "eslint-plugin-storybook": "^0.9.0",
98
102
  "jest-axe": "^8.0.0",
99
103
  "jsdom": "^24.0.0",
100
104
  "prettier": "^3.3.3",
@@ -102,7 +106,7 @@
102
106
  "react": "^18.3.1",
103
107
  "react-dom": "^18.2.0",
104
108
  "rimraf": "^5.0.5",
105
- "storybook": "^7.6.14",
109
+ "storybook": "^8.3.5",
106
110
  "tsc-files": "^1.1.4",
107
111
  "typescript": "^5.4.4",
108
112
  "vitest": "^2.0.5"
@@ -1,7 +0,0 @@
1
- import { Meta, StoryObj } from "@storybook/react";
2
- import type { ComponentProps } from "react";
3
- import { Accordion } from ".";
4
- declare const meta: Meta<typeof Accordion>;
5
- export default meta;
6
- export declare const AccordionStory: StoryObj<ComponentProps<typeof Accordion>>;
7
- export declare const AccordionWithCardStory: StoryObj<ComponentProps<typeof Accordion>>;
@@ -1,40 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import callIcon from "@material-symbols/svg-400/outlined/call-fill.svg";
3
- import { Accordion } from ".";
4
- import { Card, Svg } from "..";
5
- const meta = {
6
- component: Accordion,
7
- title: "Components/Accordion",
8
- };
9
- export default meta;
10
- const defaultArgs = {
11
- isTitleFirst: true,
12
- icon: _jsx(Svg, { src: callIcon }),
13
- title: "Titre onglet",
14
- subtitle: "Titre onglet",
15
- tagLabel: "En attente",
16
- dateLabel: "01/01/2021",
17
- dateProps: { dateTime: "2021-01-01" },
18
- value: "+ 686,00 €",
19
- children: `Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam semper magna et tempor blandit.
20
- Nulla vitae eros a odio pretium gravida. Sed eget tortor nec massa lobortis bibendum. Morbi eget
21
- ligula porttitor, euismod odio vestibulum, porta massa. Aenean vel venenatis tellus, sed iaculis nisl.`,
22
- isOpen: undefined,
23
- onClick: undefined,
24
- };
25
- export const AccordionStory = {
26
- name: "Accordion",
27
- render: (args) => _jsx(Accordion, { ...args }),
28
- args: defaultArgs,
29
- argTypes: {
30
- dateLabel: { control: "text" },
31
- },
32
- };
33
- export const AccordionWithCardStory = {
34
- name: "Accordion With Card",
35
- render: (args) => (_jsx(Card, { classModifier: "large accordion", tabIndex: undefined, children: _jsx(Accordion, { ...args }) })),
36
- args: defaultArgs,
37
- argTypes: {
38
- dateLabel: { control: "text" },
39
- },
40
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,50 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { render, screen } from "@testing-library/react";
3
- import { Accordion } from "../Accordion";
4
- describe("Accordion", () => {
5
- const originalWindowWidth = global.innerWidth;
6
- beforeAll(() => {
7
- global.innerWidth = originalWindowWidth;
8
- });
9
- it("renders correctly with all visual props", () => {
10
- const icon = "Accordion Icon";
11
- const title = "Accordion Title";
12
- const subtitle = "Accordion Subtitle";
13
- const children = "Accordion Content";
14
- const tag = "Accordion Tag";
15
- const date = "Accordion Date";
16
- const value = "Accordion Value";
17
- render(_jsx(Accordion, { icon: icon, title: title, subtitle: subtitle, tagLabel: tag, dateLabel: date, value: value, children: children }));
18
- expect(screen.getByText(icon)).toBeInTheDocument();
19
- expect(screen.getByText(title)).toBeInTheDocument();
20
- expect(screen.getByText(subtitle)).toBeInTheDocument();
21
- expect(screen.getByText(children)).toBeInTheDocument();
22
- expect(screen.getByText(tag)).toBeInTheDocument();
23
- expect(screen.getByText(date)).toBeInTheDocument();
24
- expect(screen.getByText(value)).toBeInTheDocument();
25
- expect(screen.getByText("Accordion Content").closest("details")).toHaveClass("af-accordion");
26
- });
27
- it("renders with isTitleFirst false", () => {
28
- render(_jsx(Accordion, { icon: "icon", title: "Accordion Title", dateLabel: "date", isTitleFirst: false, children: "Accordion Content" }));
29
- const summary = screen.getByText("Accordion Title").closest("summary");
30
- expect(summary).not.toHaveClass("af-accordion__summary--title-first");
31
- expect(screen.queryByText("icon")).toBeNull();
32
- expect(screen
33
- .getByText("date")
34
- .compareDocumentPosition(screen.getByText("Accordion Title"))).toBe(Node.DOCUMENT_POSITION_FOLLOWING);
35
- });
36
- it("renders with isTitleFirst true", () => {
37
- render(_jsx(Accordion, { icon: "icon", title: "Accordion Title", dateLabel: "date", isTitleFirst: true, children: "Accordion Content" }));
38
- const summary = screen.getByText("Accordion Title").closest("summary");
39
- expect(summary).toHaveClass("af-accordion__summary--title-first");
40
- expect(screen.getByText("icon").parentElement).toHaveClass("af-accordion__title-container");
41
- expect(screen
42
- .getByText("date")
43
- .compareDocumentPosition(screen.getByText("Accordion Title"))).toBe(Node.DOCUMENT_POSITION_PRECEDING);
44
- });
45
- it("renders on mobile", () => {
46
- global.innerWidth = 500;
47
- render(_jsx(Accordion, { icon: "icon", title: "Accordion Title", dateLabel: "date", children: "Accordion Content" }));
48
- expect(screen.getByText("icon").parentElement).toHaveClass("af-accordion__summary");
49
- });
50
- });
@@ -1,23 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { render, screen } from "@testing-library/react";
3
- import { AccordionTagDateContainer } from "../AccordionTagDateContainer";
4
- describe("AccordionTagDateContainer", () => {
5
- it("renders correctly", () => {
6
- const dateLabel = "01/01/2021";
7
- const dateTime = "2021-01-01";
8
- const tagLabel = "tag";
9
- render(_jsx(AccordionTagDateContainer, { tagLabel: tagLabel, dateLabel: dateLabel, dateProps: { dateTime } }));
10
- expect(screen.getByText(tagLabel).parentElement).toHaveClass("af-tag af-tag--warning");
11
- expect(screen.getByText(dateLabel)).toHaveProperty("dateTime", dateTime);
12
- });
13
- it("should pass tagProps to Tag", () => {
14
- const tag = "tag";
15
- const tagProps = { classModifier: "success" };
16
- render(_jsx(AccordionTagDateContainer, { tagLabel: tag, tagProps: tagProps }));
17
- expect(screen.getByText(tag).parentElement).toHaveClass("af-tag af-tag--success");
18
- });
19
- it("should return null if no tag or date", () => {
20
- const { container } = render(_jsx(AccordionTagDateContainer, {}));
21
- expect(container).toBeEmptyDOMElement();
22
- });
23
- });
@@ -1,8 +0,0 @@
1
- import { Meta, StoryObj } from "@storybook/react";
2
- import type { ComponentProps } from "react";
3
- import { AccordionCore } from ".";
4
- declare const meta: Meta<typeof AccordionCore>;
5
- export default meta;
6
- export declare const AccordionCoreStory: StoryObj<ComponentProps<typeof AccordionCore>>;
7
- export declare const AccordionCoreWithCustomStyledSummaryStory: StoryObj<ComponentProps<typeof AccordionCore>>;
8
- export declare const AccordionCoreWithCardStory: StoryObj<ComponentProps<typeof AccordionCore>>;
@@ -1,41 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { AccordionCore } from ".";
3
- import { Card } from "..";
4
- const meta = {
5
- component: AccordionCore,
6
- title: "Components/AccordionCore",
7
- };
8
- export default meta;
9
- const defaultArgs = {
10
- summary: "Titre onglet",
11
- children: `Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam semper magna et tempor blandit.
12
- Nulla vitae eros a odio pretium gravida. Sed eget tortor nec massa lobortis bibendum. Morbi eget
13
- ligula porttitor, euismod odio vestibulum, porta massa. Aenean vel venenatis tellus, sed iaculis nisl.`,
14
- isOpen: undefined,
15
- onClick: undefined,
16
- };
17
- export const AccordionCoreStory = {
18
- name: "AccordionCore",
19
- render: (args) => _jsx(AccordionCore, { ...args }),
20
- args: defaultArgs,
21
- };
22
- export const AccordionCoreWithCustomStyledSummaryStory = {
23
- name: "AccordionCore With Custom Styled Summary",
24
- render: (args) => _jsx(AccordionCore, { ...args }),
25
- args: {
26
- summary: (_jsx("div", { style: {
27
- backgroundColor: "red",
28
- paddingBottom: "32px",
29
- } })),
30
- children: `Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam semper magna et tempor blandit.
31
- Nulla vitae eros a odio pretium gravida. Sed eget tortor nec massa lobortis bibendum. Morbi eget
32
- ligula porttitor, euismod odio vestibulum, porta massa. Aenean vel venenatis tellus, sed iaculis nisl.`,
33
- isOpen: undefined,
34
- onClick: undefined,
35
- },
36
- };
37
- export const AccordionCoreWithCardStory = {
38
- name: "AccordionCore With Card",
39
- render: (args) => (_jsx(Card, { classModifier: "large accordion", tabIndex: undefined, children: _jsx(AccordionCore, { ...args }) })),
40
- args: defaultArgs,
41
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,47 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { render, screen } from "@testing-library/react";
3
- import { AccordionCore } from "../AccordionCore";
4
- describe("AccordionCore", () => {
5
- it("renders correctly with all visual props", () => {
6
- const title = "Accordion Title";
7
- const children = "Accordion Content";
8
- render(_jsx(AccordionCore, { summary: title, children: children }));
9
- expect(screen.getByText(title)).toBeInTheDocument();
10
- expect(screen.getByText(children)).toBeInTheDocument();
11
- expect(screen.getByText("Accordion Content").closest("details")).toHaveClass("af-accordion");
12
- const details = screen.getByText(children).closest("details");
13
- expect(details).not.toHaveAttribute("open");
14
- const summary = screen.getByText("Accordion Title");
15
- summary.click();
16
- expect(details).toHaveAttribute("open");
17
- summary.click();
18
- expect(details).not.toHaveAttribute("open");
19
- });
20
- it("should have custom class with modifier", () => {
21
- const className = "custom-class";
22
- const classModifier = "modifier";
23
- render(_jsx(AccordionCore, { summary: "Accordion Title", className: className, classModifier: classModifier, children: "Accordion Content" }));
24
- expect(screen.getByText("Accordion Content").closest("details")).toHaveClass(`${className} ${className}--${classModifier}`);
25
- });
26
- it("renders Accordion with open details", () => {
27
- render(_jsx(AccordionCore, { summary: "Accordion Title", isOpen: true, children: "Accordion Content" }));
28
- const details = screen.getByText("Accordion Content").closest("details");
29
- expect(details).toHaveAttribute("open");
30
- });
31
- it("renders Accordion with close details", () => {
32
- render(_jsx(AccordionCore, { summary: "Accordion Title", isOpen: false, children: "Accordion Content" }));
33
- const details = screen.getByText("Accordion Content").closest("details");
34
- expect(details).not.toHaveAttribute("open");
35
- });
36
- it("use onClick prop when summary click", () => {
37
- const onClick = vi.fn();
38
- render(_jsx(AccordionCore, { summary: "Accordion Title", onClick: onClick, children: "Accordion Content" }));
39
- const summary = screen.getByText("Accordion Title");
40
- summary.click();
41
- expect(onClick).toHaveBeenCalled();
42
- });
43
- it("renders with custom title summary", () => {
44
- render(_jsx(AccordionCore, { summary: _jsx("p", { className: "custom-title", children: "Custom Title" }), children: "Accordion Content" }));
45
- expect(screen.getByText("Custom Title")).toHaveClass("custom-title");
46
- });
47
- });
@@ -1,6 +0,0 @@
1
- import { Meta, StoryObj } from "@storybook/react";
2
- import { Alert } from "./Alert";
3
- declare const meta: Meta<typeof Alert>;
4
- export default meta;
5
- export declare const Default: StoryObj<typeof Alert>;
6
- export declare const WithButtonAction: StoryObj<typeof Alert>;
@@ -1,37 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Alert } from "./Alert";
3
- import { Link } from "../Link/Link";
4
- import { ButtonClient, Variants } from "../Button/Button";
5
- const MODIFIERS = ["information", "neutral", "error", "validation", "warning"];
6
- const meta = {
7
- title: "Components/Alert",
8
- component: Alert,
9
- };
10
- export default meta;
11
- export const Default = {
12
- name: "Default",
13
- args: {
14
- title: "My Alert title",
15
- type: "information",
16
- children: "Vestibulum nunc neque, sodales non luctus in, dictum vitae nisl. Curabitur vitae massa non nisl lacinia tempus. Pellentesque id nulla tortor.",
17
- action: (_jsx(Link, { openInNewTab: true, href: "https://fakelink.com", children: "Plus de d\u00E9tails" })),
18
- iconSize: 24,
19
- },
20
- argTypes: {
21
- type: {
22
- options: MODIFIERS,
23
- control: { type: "select" },
24
- defaultValue: "information",
25
- },
26
- },
27
- };
28
- export const WithButtonAction = {
29
- name: "Alert with Button action",
30
- args: {
31
- title: "My Alert title",
32
- type: "information",
33
- children: "Vestibulum nunc neque, sodales non luctus in, dictum vitae nisl. Curabitur vitae massa non nisl lacinia tempus. Pellentesque id nulla tortor.",
34
- action: _jsx(ButtonClient, { variant: Variants.ghost, children: "Actualiser" }),
35
- iconSize: 24,
36
- },
37
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,33 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { render, screen } from "@testing-library/react";
3
- import { Alert, alertTypes } from "../Alert";
4
- import { Link } from "../../Link/Link";
5
- import { ButtonClient, Variants } from "../../Button/Button";
6
- const MoreDetails = () => (_jsx(Link, { openInNewTab: true, href: "https://fakelink.com", children: "Plus de d\u00E9tails" }));
7
- describe("Alert", () => {
8
- it.each `
9
- type | title | children | action | icon | iconSize | expectLink | expectButton
10
- ${undefined} | ${undefined} | ${undefined} | ${undefined} | ${"wb_incandescent.svg"} | ${undefined} | ${false} | ${false}
11
- ${alertTypes.information} | ${"my title"} | ${"some text"} | ${(_jsx(MoreDetails, {}))} | ${"wb_incandescent.svg"} | ${undefined} | ${true} | ${false}
12
- ${alertTypes.error} | ${"my title"} | ${"some text"} | ${(_jsx(MoreDetails, {}))} | ${"emergency_home.svg"} | ${undefined} | ${true} | ${false}
13
- ${alertTypes.neutral} | ${"my title"} | ${"some text"} | ${(_jsx(MoreDetails, {}))} | ${"error.svg"} | ${undefined} | ${true} | ${false}
14
- ${alertTypes.validation} | ${"my title"} | ${"some text"} | ${(_jsx(MoreDetails, {}))} | ${"check_circle.svg"} | ${undefined} | ${true} | ${false}
15
- ${alertTypes.warning} | ${"my title"} | ${"some text"} | ${(_jsx(ButtonClient, { variant: Variants.ghost, children: "Actualiser" }))} | ${"error.svg"} | ${undefined} | ${false} | ${true}
16
- `("Should render correctly with type: $type, title: $title, children: $children, icon: $icon, action: $action, iconSize: $iconSize", ({ type, title, children, action, icon, iconSize, expectLink, expectButton, }) => {
17
- const { container } = render(_jsx(Alert, { type, title, action, iconSize, children: children }));
18
- if (title) {
19
- expect(screen.getByText(RegExp(title))).toBeDefined();
20
- }
21
- if (children) {
22
- expect(screen.getByText(RegExp(children))).toBeDefined();
23
- }
24
- expect(screen.getByRole("alert")).toHaveClass(`af-alert--${type || alertTypes.information}`);
25
- if (expectLink && action) {
26
- expect(screen.getByRole("link")).toHaveAttribute("href", "https://fakelink.com");
27
- }
28
- if (expectButton && action) {
29
- expect(screen.getByRole("button", { name: /Actualiser/ })).toBeInTheDocument();
30
- }
31
- expect(container.querySelector(`[data-src$="${icon}"]`)).toBeDefined();
32
- });
33
- });
@@ -1,22 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
2
- import { ReactNode } from "react";
3
- import { ButtonClient, Variants } from "./Button";
4
- declare const meta: Meta<typeof ButtonClient>;
5
- export default meta;
6
- type StoryProps = Omit<React.ComponentProps<typeof ButtonClient>, "children" | "variant" | "disabled" | "iconLeft" | "iconRight"> & {
7
- children: string;
8
- variant: Variants;
9
- disabled: boolean;
10
- iconLeft: ReactNode;
11
- iconRight: ReactNode;
12
- };
13
- type Story = StoryObj<StoryProps>;
14
- export declare const Playground: Story;
15
- export declare const Business: StoryObj<typeof ButtonClient>;
16
- export declare const Secondary: StoryObj<typeof ButtonClient>;
17
- export declare const SecondaryError: StoryObj<typeof ButtonClient>;
18
- export declare const Tertiary: StoryObj<typeof ButtonClient>;
19
- export declare const Ghost: StoryObj<typeof ButtonClient>;
20
- export declare const MultiExamples: StoryObj<typeof ButtonClient>;
21
- export declare const WithIconRight: StoryObj<typeof ButtonClient>;
22
- export declare const WithIconLeft: StoryObj<typeof ButtonClient>;
@@ -1,99 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import accountBalance from "@material-symbols/svg-400/outlined/account_balance.svg";
3
- import arrowBack from "@material-symbols/svg-400/outlined/arrow_back.svg";
4
- import biotech from "@material-symbols/svg-400/outlined/biotech.svg";
5
- import code from "@material-symbols/svg-400/outlined/code.svg";
6
- import fireExtinguisher from "@material-symbols/svg-400/outlined/fire_extinguisher.svg";
7
- import heartBroken from "@material-symbols/svg-400/outlined/heart_broken.svg";
8
- import { ButtonClient, Variants } from "./Button";
9
- import { Svg } from "../Svg";
10
- const meta = {
11
- component: ButtonClient,
12
- title: "Components/Button",
13
- parameters: {
14
- layout: "centered",
15
- },
16
- argTypes: { onClick: { action: "clicked" } },
17
- };
18
- export default meta;
19
- export const Playground = {
20
- name: "Button",
21
- render: ({ children: text, variant, disabled, iconLeft, iconRight, onClick, ...args }) => (_jsx(ButtonClient, { variant: variant, iconLeft: iconLeft, iconRight: iconRight, disabled: disabled, onClick: onClick, ...args, children: text })),
22
- args: {
23
- children: "Button",
24
- },
25
- argTypes: {
26
- variant: {
27
- options: Variants,
28
- control: { type: "multi-select" },
29
- },
30
- iconLeft: {
31
- control: { type: "input" },
32
- },
33
- iconRight: {
34
- control: { type: "input" },
35
- },
36
- },
37
- };
38
- export const Business = {
39
- name: "Button business",
40
- args: {
41
- children: "Button Business",
42
- variant: Variants.business,
43
- },
44
- };
45
- export const Secondary = {
46
- name: "Button secondary",
47
- args: {
48
- children: "Button Secondary",
49
- variant: Variants.secondary,
50
- },
51
- };
52
- export const SecondaryError = {
53
- name: "Button secondary error",
54
- args: {
55
- children: "Button Secondary Error",
56
- variant: Variants.secondaryError,
57
- },
58
- };
59
- export const Tertiary = {
60
- name: "Button tertiary",
61
- args: {
62
- children: "Button Tertiary",
63
- variant: Variants.tertiary,
64
- },
65
- };
66
- export const Ghost = {
67
- name: "Button ghost",
68
- args: {
69
- children: "Button Ghost",
70
- variant: Variants.ghost,
71
- },
72
- };
73
- export const MultiExamples = {
74
- name: "Button examples",
75
- render: () => {
76
- return (_jsxs("div", { style: {
77
- display: "flex",
78
- justifyContent: "space-evenly",
79
- alignItems: "center",
80
- padding: "2rem",
81
- flexWrap: "wrap",
82
- gap: "2rem",
83
- }, children: [_jsx(ButtonClient, { children: "Button Default" }), _jsx(ButtonClient, { disabled: true, children: "Button Disabled" }), _jsx(ButtonClient, { variant: Variants.business, children: "Button Business" }), _jsx(ButtonClient, { variant: Variants.business, disabled: true, children: "Button Business Disabled" }), _jsx(ButtonClient, { variant: Variants.secondary, children: "Button Secondary" }), _jsx(ButtonClient, { variant: Variants.secondary, disabled: true, children: "Button Secondary Disabled" }), _jsx(ButtonClient, { variant: Variants.secondaryError, children: "Button Secondary Error" }), _jsx(ButtonClient, { variant: Variants.secondaryError, disabled: true, children: "Button Secondary Error Disabled" }), _jsx(ButtonClient, { variant: Variants.tertiary, children: "Button Tertiary" }), _jsx(ButtonClient, { variant: Variants.tertiary, disabled: true, children: "Button Tertiary Disabled" }), _jsx(ButtonClient, { variant: Variants.ghost, children: "Button Ghost" }), _jsx(ButtonClient, { iconRight: _jsx(Svg, { src: arrowBack, fill: "white" }), children: "test" }), _jsx(ButtonClient, { variant: Variants.secondary, iconRight: _jsx(Svg, { src: code, fill: "#00008F" }), children: "With icon" }), _jsx(ButtonClient, { variant: Variants.tertiary, iconLeft: _jsx(Svg, { src: fireExtinguisher, fill: "#00008F" }), children: "With icon" }), _jsx(ButtonClient, { variant: Variants.business, iconRight: _jsx(Svg, { src: biotech, fill: "white" }), children: "With icon" }), _jsx(ButtonClient, { variant: Variants.ghost, iconLeft: _jsx(Svg, { src: accountBalance, fill: "#00008F" }), iconRight: _jsx(Svg, { src: heartBroken, fill: "#00008F" }), children: "With icon MULTI" })] }));
84
- },
85
- };
86
- export const WithIconRight = {
87
- name: "Button with right icon",
88
- args: {
89
- children: "With icon",
90
- iconRight: _jsx(Svg, { src: heartBroken }),
91
- },
92
- };
93
- export const WithIconLeft = {
94
- name: "Button with left icon",
95
- args: {
96
- children: "With icon",
97
- iconLeft: _jsx(Svg, { src: heartBroken }),
98
- },
99
- };
@@ -1,6 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
2
- import { Card } from ".";
3
- declare const meta: Meta<typeof Card>;
4
- export default meta;
5
- export declare const Default: StoryObj<typeof Card>;
6
- export declare const ButtonCard: StoryObj<typeof Card>;
@@ -1,40 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Card } from ".";
3
- const MODIFIERS = [" ", "elevation-2"];
4
- const CUSTOM_CHILDREN = (_jsxs(_Fragment, { children: [_jsx("h1", { className: "af-card__title", children: "My card title" }), _jsx("p", { children: "My card content" })] }));
5
- const meta = {
6
- title: "Components/Card",
7
- component: Card,
8
- };
9
- export default meta;
10
- export const Default = {
11
- name: "Card",
12
- render: (args) => _jsx(Card, { ...args }),
13
- args: {
14
- children: CUSTOM_CHILDREN,
15
- classModifier: " ",
16
- },
17
- argTypes: {
18
- classModifier: {
19
- options: MODIFIERS,
20
- control: { type: "select" },
21
- defaultValue: " ",
22
- },
23
- },
24
- };
25
- export const ButtonCard = {
26
- name: "Button Card",
27
- render: (args) => _jsx(Card, { ...args }),
28
- args: {
29
- children: CUSTOM_CHILDREN,
30
- classModifier: " ",
31
- },
32
- argTypes: {
33
- classModifier: {
34
- options: MODIFIERS,
35
- control: { type: "select" },
36
- defaultValue: " ",
37
- },
38
- onClick: { action: "onClick" },
39
- },
40
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,27 +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 { Card } from "../Card";
5
- describe("Card", () => {
6
- it("should render children", () => {
7
- render(_jsx(Card, { children: "A card" }));
8
- const card = screen.getByText("A card");
9
- expect(card).toHaveClass("af-card");
10
- });
11
- it("should have custom class", () => {
12
- render(_jsx(Card, { className: "custom-class", children: "A card" }));
13
- expect(screen.getByText("A card")).toHaveClass("custom-class");
14
- });
15
- it("should have custom class with modifier", () => {
16
- render(_jsx(Card, { className: "custom-class", classModifier: "modifier", children: "A card" }));
17
- expect(screen.getByText("A card")).toHaveClass("custom-class custom-class--modifier");
18
- });
19
- it("should call onClick when card button clicked", async () => {
20
- const onClick = vi.fn();
21
- render(_jsx(Card, { onClick: onClick, children: "A card" }));
22
- userEvent.click(screen.getByRole("button", { name: "A card" }));
23
- await waitFor(() => {
24
- expect(onClick).toHaveBeenCalled();
25
- });
26
- });
27
- });
@@ -1,6 +0,0 @@
1
- import { Meta, StoryObj } from "@storybook/react";
2
- import { ComponentProps } from "react";
3
- import { Checkbox } from "./Checkbox";
4
- declare const meta: Meta;
5
- export default meta;
6
- export declare const CheckboxStory: StoryObj<ComponentProps<typeof Checkbox>>;