@agregio-solutions/design-system 1.90.1 → 1.92.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/design-system.cjs +9 -5
- package/dist/design-system.js +14 -6
- package/dist/packages/components/Accordion/doc.md +342 -0
- package/dist/packages/components/Badge/doc.md +192 -0
- package/dist/packages/components/Breadcrumbs/doc.md +332 -0
- package/dist/packages/components/Button/doc.md +425 -0
- package/dist/packages/components/Calendar/doc.md +465 -0
- package/dist/packages/components/ChartLegend/doc.md +151 -0
- package/dist/packages/components/ChartTooltip/doc.md +124 -0
- package/dist/packages/components/Checkbox/doc.md +329 -0
- package/dist/packages/components/CheckboxGroup/doc.md +242 -0
- package/dist/packages/components/Chip/doc.md +99 -0
- package/dist/packages/components/Combobox/Combobox.d.ts +8 -0
- package/dist/packages/components/Combobox/doc.md +680 -0
- package/dist/packages/components/DataTable/doc.md +1124 -0
- package/dist/packages/components/DatePicker/doc.md +579 -0
- package/dist/packages/components/DateRangePicker/doc.md +638 -0
- package/dist/packages/components/Drawer/doc.md +338 -0
- package/dist/packages/components/Dropdown/Dropdown.d.ts +4 -0
- package/dist/packages/components/Dropdown/doc.md +205 -0
- package/dist/packages/components/EmptyState/doc.md +101 -0
- package/dist/packages/components/FileUpload/doc.md +449 -0
- package/dist/packages/components/Filter/doc.md +196 -0
- package/dist/packages/components/Header/doc.md +373 -0
- package/dist/packages/components/I18nProvider/doc.md +187 -0
- package/dist/packages/components/Icon/doc.md +63 -0
- package/dist/packages/components/Label/doc.md +60 -0
- package/dist/packages/components/LinearProgressBar/doc.md +148 -0
- package/dist/packages/components/Link/doc.md +206 -0
- package/dist/packages/components/List/doc.md +481 -0
- package/dist/packages/components/Loader/doc.md +53 -0
- package/dist/packages/components/Menu/Menu.d.ts +5 -1
- package/dist/packages/components/Menu/doc.md +231 -0
- package/dist/packages/components/Message/doc.md +166 -0
- package/dist/packages/components/Modal/doc.md +289 -0
- package/dist/packages/components/Navigation/doc.md +992 -0
- package/dist/packages/components/NavigationItem/doc.md +167 -0
- package/dist/packages/components/NotificationCard/doc.md +206 -0
- package/dist/packages/components/Notifications/doc.md +240 -0
- package/dist/packages/components/NumberField/doc.md +582 -0
- package/dist/packages/components/PageLayout/doc.md +651 -0
- package/dist/packages/components/Pagination/doc.md +227 -0
- package/dist/packages/components/Popover/doc.md +245 -0
- package/dist/packages/components/Radio/doc.md +370 -0
- package/dist/packages/components/RouterProvider/doc.md +64 -0
- package/dist/packages/components/SearchBar/doc.md +504 -0
- package/dist/packages/components/SegmentedControl/doc.md +398 -0
- package/dist/packages/components/Select/Select.d.ts +4 -0
- package/dist/packages/components/Select/doc.md +1133 -0
- package/dist/packages/components/Skeleton/doc.md +129 -0
- package/dist/packages/components/Slider/doc.md +362 -0
- package/dist/packages/components/Stepper/doc.md +104 -0
- package/dist/packages/components/Switch/doc.md +296 -0
- package/dist/packages/components/Tabs/doc.md +295 -0
- package/dist/packages/components/Tag/doc.md +81 -0
- package/dist/packages/components/TextInput/doc.md +490 -0
- package/dist/packages/components/TimeField/doc.md +353 -0
- package/dist/packages/components/Timeline/doc.md +1046 -0
- package/dist/packages/components/Toaster/doc.md +263 -0
- package/dist/packages/components/ToggleButton/doc.md +108 -0
- package/dist/packages/components/ToggleButtonGroup/doc.md +307 -0
- package/dist/packages/components/Tooltip/doc.md +206 -0
- package/dist/packages/components/YearMonthPicker/YearMonthPicker.d.ts +8 -0
- package/dist/packages/components/YearMonthPicker/doc.md +638 -0
- package/dist/public_docs/components.md +68 -0
- package/dist/public_docs/index.md +30 -0
- package/dist/public_docs/tokens.md +121 -0
- package/package.json +3 -2
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# LinearProgressBar
|
|
2
|
+
|
|
3
|
+
## Props
|
|
4
|
+
|
|
5
|
+
The complete Props documentation with JS doc for this component is available at this path:
|
|
6
|
+
|
|
7
|
+
node_modules/@agregio-solutions/design-system/dist/packages/components/LinearProgressBar/LinearProgressBar.d.ts
|
|
8
|
+
|
|
9
|
+
## Example usage
|
|
10
|
+
|
|
11
|
+
Here are the Storybook Stories.
|
|
12
|
+
|
|
13
|
+
Base stories:
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { Meta, StoryObj } from "@storybook/react-vite";
|
|
17
|
+
import { within, expect } from "storybook/test";
|
|
18
|
+
import ProgressBar from "./LinearProgressBar";
|
|
19
|
+
import { useEffect } from "react";
|
|
20
|
+
import { useState } from "react";
|
|
21
|
+
|
|
22
|
+
const meta: Meta<typeof ProgressBar> = {
|
|
23
|
+
component: ProgressBar,
|
|
24
|
+
tags: ["autodocs"],
|
|
25
|
+
parameters: {
|
|
26
|
+
layout: "centered",
|
|
27
|
+
},
|
|
28
|
+
globals: {
|
|
29
|
+
backgrounds: { value: "light" },
|
|
30
|
+
},
|
|
31
|
+
argTypes: {
|
|
32
|
+
title: { control: "text" },
|
|
33
|
+
description: { control: "text" },
|
|
34
|
+
},
|
|
35
|
+
decorators: [
|
|
36
|
+
(Story) => (
|
|
37
|
+
<div style={{ width: 220 }}>
|
|
38
|
+
<Story />
|
|
39
|
+
</div>
|
|
40
|
+
),
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
export default meta;
|
|
44
|
+
|
|
45
|
+
type Story = StoryObj<typeof meta>;
|
|
46
|
+
|
|
47
|
+
export const Playground: Story = {
|
|
48
|
+
args: {
|
|
49
|
+
title: "Progress title",
|
|
50
|
+
percentage: 25,
|
|
51
|
+
description: "Description",
|
|
52
|
+
hidePercentValue: false,
|
|
53
|
+
},
|
|
54
|
+
play: async ({ canvasElement, args }) => {
|
|
55
|
+
const canvas = within(canvasElement);
|
|
56
|
+
|
|
57
|
+
await canvas.findByText("Progress title");
|
|
58
|
+
await canvas.findByText("Description");
|
|
59
|
+
await canvas.findByText("25%");
|
|
60
|
+
const container = await canvas.findByTestId("progress-bar-Progress title");
|
|
61
|
+
const filler = container.firstElementChild as HTMLElement;
|
|
62
|
+
|
|
63
|
+
await expect(
|
|
64
|
+
Math.round((filler.clientWidth / container.clientWidth) * 100),
|
|
65
|
+
).toEqual(args.percentage);
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const Small: Story = {
|
|
70
|
+
args: {
|
|
71
|
+
...Playground.args,
|
|
72
|
+
size: "small",
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const ZeroPercent: Story = {
|
|
77
|
+
args: {
|
|
78
|
+
...Playground.args,
|
|
79
|
+
percentage: 0,
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const HundredPercent: Story = {
|
|
84
|
+
args: {
|
|
85
|
+
...Playground.args,
|
|
86
|
+
percentage: 100,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export const Error: Story = {
|
|
91
|
+
args: {
|
|
92
|
+
...Playground.args,
|
|
93
|
+
nature: "negative",
|
|
94
|
+
percentage: 100,
|
|
95
|
+
hidePercentValue: true,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const Success: Story = {
|
|
100
|
+
args: {
|
|
101
|
+
...Playground.args,
|
|
102
|
+
nature: "positive",
|
|
103
|
+
percentage: 100,
|
|
104
|
+
hidePercentValue: true,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const OverflowingText: Story = {
|
|
109
|
+
args: {
|
|
110
|
+
...Playground.args,
|
|
111
|
+
nature: "positive",
|
|
112
|
+
title: "This is a very long title that overflows and should be handled",
|
|
113
|
+
description:
|
|
114
|
+
"This is a very long description that overflows and should be handled",
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export const AnimationProgress: Story = {
|
|
119
|
+
parameters: {
|
|
120
|
+
chromatic: { disableSnapshot: true },
|
|
121
|
+
},
|
|
122
|
+
render: () => {
|
|
123
|
+
const ParentComponent = () => {
|
|
124
|
+
const [progress, setProgress] = useState(0);
|
|
125
|
+
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
const timer = setInterval(() => {
|
|
128
|
+
setProgress((oldProgress) => {
|
|
129
|
+
if (oldProgress === 100) {
|
|
130
|
+
return 0;
|
|
131
|
+
}
|
|
132
|
+
const diff = Math.random() * 10;
|
|
133
|
+
return Math.min(oldProgress + diff, 100);
|
|
134
|
+
});
|
|
135
|
+
}, 500);
|
|
136
|
+
|
|
137
|
+
return () => {
|
|
138
|
+
clearInterval(timer);
|
|
139
|
+
};
|
|
140
|
+
}, []);
|
|
141
|
+
|
|
142
|
+
return <ProgressBar title="Progress title" percentage={progress} />;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
return <ParentComponent />;
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
```
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# Link
|
|
2
|
+
|
|
3
|
+
## Props
|
|
4
|
+
|
|
5
|
+
The complete Props documentation with JS doc for this component is available at this path:
|
|
6
|
+
|
|
7
|
+
node_modules/@agregio-solutions/design-system/dist/packages/components/Link/Link.d.ts
|
|
8
|
+
|
|
9
|
+
## Example usage
|
|
10
|
+
|
|
11
|
+
Here are the Storybook Stories.
|
|
12
|
+
|
|
13
|
+
Base stories:
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { Meta, StoryObj } from "@storybook/react-vite";
|
|
17
|
+
import Link from "./Link";
|
|
18
|
+
import { within, expect } from "storybook/test";
|
|
19
|
+
|
|
20
|
+
const meta: Meta<typeof Link> = {
|
|
21
|
+
component: Link,
|
|
22
|
+
parameters: {
|
|
23
|
+
layout: "centered",
|
|
24
|
+
},
|
|
25
|
+
argTypes: {
|
|
26
|
+
children: { control: "text" },
|
|
27
|
+
href: { control: "text" },
|
|
28
|
+
download: { control: "text" },
|
|
29
|
+
className: { control: "text" },
|
|
30
|
+
target: { control: false },
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
export default meta;
|
|
34
|
+
|
|
35
|
+
export const Playground: StoryObj<typeof Link> = {
|
|
36
|
+
args: {
|
|
37
|
+
children: "Label link",
|
|
38
|
+
href: "https://example.com",
|
|
39
|
+
},
|
|
40
|
+
play: async ({ canvasElement, args }) => {
|
|
41
|
+
const canvas = within(canvasElement);
|
|
42
|
+
await expect(
|
|
43
|
+
canvas.getByText(args.children as string).parentElement,
|
|
44
|
+
).toHaveAttribute("href", args.href);
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const WithIcon: StoryObj<typeof Link> = {
|
|
49
|
+
args: {
|
|
50
|
+
...Playground.args,
|
|
51
|
+
showLinkIcon: true,
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const Informative: StoryObj<typeof Link> = {
|
|
56
|
+
args: {
|
|
57
|
+
...WithIcon.args,
|
|
58
|
+
nature: "informative",
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const Positive: StoryObj<typeof Link> = {
|
|
63
|
+
args: {
|
|
64
|
+
...WithIcon.args,
|
|
65
|
+
nature: "positive",
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const Negative: StoryObj<typeof Link> = {
|
|
70
|
+
args: {
|
|
71
|
+
...WithIcon.args,
|
|
72
|
+
nature: "negative",
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const Warning: StoryObj<typeof Link> = {
|
|
77
|
+
args: {
|
|
78
|
+
...WithIcon.args,
|
|
79
|
+
nature: "warning",
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## How to test this component
|
|
85
|
+
|
|
86
|
+
Here are some more advanced stories with more testing coverage and examples that you can read to understand how to test this component.
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
import { Meta, StoryObj } from "@storybook/react-vite";
|
|
90
|
+
import Link from "../Link";
|
|
91
|
+
import { within, expect, userEvent } from "storybook/test";
|
|
92
|
+
import { Route, Routes } from "react-router-dom";
|
|
93
|
+
import { expectNotPresent } from "@internal/test-utils-storybook/test-utils-storybook";
|
|
94
|
+
|
|
95
|
+
const meta: Meta<typeof Link> = {
|
|
96
|
+
component: Link,
|
|
97
|
+
parameters: {
|
|
98
|
+
layout: "centered",
|
|
99
|
+
chromatic: { disableSnapshot: true },
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
export default meta;
|
|
103
|
+
|
|
104
|
+
export const ShouldWorkWithReactRouter: StoryObj<typeof Link> = {
|
|
105
|
+
render: () => {
|
|
106
|
+
const Demo = () => {
|
|
107
|
+
return (
|
|
108
|
+
<>
|
|
109
|
+
<Link href="/page-1">Page 1</Link>
|
|
110
|
+
<Link href="/page-2">Page 2</Link>
|
|
111
|
+
<Link href="/page-3">Page 3</Link>
|
|
112
|
+
|
|
113
|
+
<Routes>
|
|
114
|
+
<Route path="/page-1" element={<div>Content page 1</div>} />
|
|
115
|
+
<Route path="/page-2" element={<div>Content page 2</div>} />
|
|
116
|
+
<Route path="/page-3" element={<div>Content page 3</div>} />
|
|
117
|
+
</Routes>
|
|
118
|
+
</>
|
|
119
|
+
);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const Pages = () => (
|
|
123
|
+
<Routes>
|
|
124
|
+
<Route path="/*" element={<Demo />} />
|
|
125
|
+
</Routes>
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
return <Pages />;
|
|
129
|
+
},
|
|
130
|
+
play: async ({ canvasElement }) => {
|
|
131
|
+
const canvas = within(canvasElement);
|
|
132
|
+
const user = userEvent.setup({ delay: 50 });
|
|
133
|
+
await canvas.findByText("Page 1");
|
|
134
|
+
await expect(canvas.getByText("Page 1").parentElement).toHaveAttribute(
|
|
135
|
+
"href",
|
|
136
|
+
"/page-1",
|
|
137
|
+
);
|
|
138
|
+
await expect(canvas.getByText("Page 2").parentElement).toHaveAttribute(
|
|
139
|
+
"href",
|
|
140
|
+
"/page-2",
|
|
141
|
+
);
|
|
142
|
+
await expect(canvas.getByText("Page 3").parentElement).toHaveAttribute(
|
|
143
|
+
"href",
|
|
144
|
+
"/page-3",
|
|
145
|
+
);
|
|
146
|
+
await expectNotPresent(() => canvas.queryByText("Content page 1"));
|
|
147
|
+
await expectNotPresent(() => canvas.queryByText("Content page 2"));
|
|
148
|
+
await expectNotPresent(() => canvas.queryByText("Content page 3"));
|
|
149
|
+
|
|
150
|
+
await user.click(canvas.getByText("Page 1"));
|
|
151
|
+
await expect(canvas.getByText("Content page 1")).toBeInTheDocument();
|
|
152
|
+
await expectNotPresent(() => canvas.queryByText("Content page 2"));
|
|
153
|
+
await expectNotPresent(() => canvas.queryByText("Content page 3"));
|
|
154
|
+
|
|
155
|
+
await user.click(canvas.getByText("Page 2"));
|
|
156
|
+
await expect(canvas.getByText("Content page 2")).toBeInTheDocument();
|
|
157
|
+
await expectNotPresent(() => canvas.queryByText("Content page 1"));
|
|
158
|
+
await expectNotPresent(() => canvas.queryByText("Content page 3"));
|
|
159
|
+
|
|
160
|
+
await user.click(canvas.getByText("Page 3"));
|
|
161
|
+
await expect(canvas.getByText("Content page 3")).toBeInTheDocument();
|
|
162
|
+
await expectNotPresent(() => canvas.queryByText("Content page 1"));
|
|
163
|
+
await expectNotPresent(() => canvas.queryByText("Content page 2"));
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Developer notes
|
|
169
|
+
|
|
170
|
+
Here are the notes available for the developer on the built Storybook, you can read them to understand the component and how to use it.
|
|
171
|
+
|
|
172
|
+
````mdx
|
|
173
|
+
import { Canvas, Meta, Stories, Controls } from "@storybook/addon-docs/blocks";
|
|
174
|
+
|
|
175
|
+
import * as Link from "./Link.stories";
|
|
176
|
+
|
|
177
|
+
<Meta of={Link} />
|
|
178
|
+
|
|
179
|
+
# Link
|
|
180
|
+
|
|
181
|
+
<Canvas of={Link.Playground} />
|
|
182
|
+
|
|
183
|
+
## Link props
|
|
184
|
+
|
|
185
|
+
<Controls of={Link.Playground} />
|
|
186
|
+
|
|
187
|
+
## Integration with framework routers
|
|
188
|
+
|
|
189
|
+
It is possible to make this `Link` component work seamlessly with your router (like `react-router-dom`) and thus benefit from client-side routing.
|
|
190
|
+
|
|
191
|
+
The first requirement is to have the [RouterProvider](?path=/docs/components-routerprovider--docs) configured in your project.
|
|
192
|
+
|
|
193
|
+
And that's it! With this provider, any `Link` component will behave like your framework-specific link.
|
|
194
|
+
You can even pass router-specific props with the `routerOptions` prop, like:
|
|
195
|
+
|
|
196
|
+
```tsx
|
|
197
|
+
import { Link } from "@agregio-solutions/design-system";
|
|
198
|
+
|
|
199
|
+
<Link href="/some-url" routerOptions={{ replace: true }}>
|
|
200
|
+
{/* ☝️ replace option in the react-router-dom NavLink ! */}
|
|
201
|
+
Go!
|
|
202
|
+
</Link>;
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
<Stories />
|
|
206
|
+
````
|